Squirrel/Server/Functions/Players/Pos

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
 
Line 10: Line 10:
 
== Arguments ==
 
== Arguments ==
  
* '''vPos''' - This is the new position for the player as a vector
+
* '''vPos''' - This is the new position for the player as a [[Squirrel/Script_Types/Vector|Vector]]
  
 
== Example 1. Returning ==
 
== Example 1. Returning ==

Latest revision as of 11:24, 12 October 2010

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events


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

[edit] Syntax

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

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

[edit] Arguments

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

[edit] 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.

[edit] 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).

[edit] Notes

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

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox