Squirrel/Script Types/Vector

From Liberty Unleashed Wiki
Revision as of 18:32, 21 August 2009 by Juppi (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Vector type is a 3-dimensional vector used to set/return positions and rotations for elements such as players, vehicles, objects etc.

Constructor

  1. Vector( float x, float y, float z )

Values

  • x - The X coordinate of the vector
  • y - The Y coordinate of the vector
  • z - The Z coordinate of the vector

Example

This will return and show player's position when they type '/pos'

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "pos" )
  5. {
  6. local pos = player.Pos; // Save the position vector to a local variable
  7. MessagePlayer( "Your position: " + pos.x + ", " + pos.y + ", " + pos.z , player );
  8. }
  9. }
  10.  

Types

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox