Player.Pos

From Liberty Unleashed Wiki
Revision as of 11:24, 12 October 2010 by VRocker (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events


This Player class member returns or sets the position of the given player.

Syntax

You can either return or set a new value using this member:

  1. Vector player.Pos
  1. player.Pos = Vector vPos

Arguments

  • vPos - This is the new position for the player as a Vector

Example 1. Returning

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "mypos" )
  5. {
  6. MessagePlayer( "Your current position is: " + player.Pos, player );
  7. }
  8. }
  9.  

This command will tell the player their current co-ordinates.

Example 2. Setting

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "setmypos" )
  5. {
  6. local newpos = Vector( 100.00, 90.00, 1.00 );
  7. player.Pos = newpos;
  8. }
  9. }
  10.  

This command will set the players position to the co-ordinates of 100.00 (X), 90.00 (Y), 1.00 (Z).

Notes

The call onPlayerCommand was used in in this example. More info about this in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox