Squirrel/Server/Functions/Pickups/Pos

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with '{{Squirrel/Title|Pickup.Pos}} __NOTOC__ This ''Pickup'' class member returns or sets the position of the given pickup. == Syntax == You can either return or set a new value usin…')
 

Latest revision as of 11:30, 12 October 2010

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


This Pickup class member returns or sets the position of the given pickup.

[edit] Syntax

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

  1. Vector pickup.Pos
  1. pickup.Pos = Vector vPos

[edit] Arguments

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

[edit] Example 1. Returning

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "pickuppos" )
  5. {
  6. local pickup = FindPickup( 0 );
  7. if ( pickup ) MessagePlayer( "Pickup 0s position is: " + pickup.Pos, player );
  8. else MessagePlayer( "Pickup 0 does not exist", player );
  9. }
  10. }
  11.  

This command will tell the player the co-ordinates of pickup id 0.

[edit] Example 2. Setting

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

This command will set the pickup with ID 0s position to the co-ordinates of 100.00 (X), 90.00 (Y), 1.00 (Z).

[edit] Notes

The function FindPickup and eventonPlayerCommand 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