Squirrel/Server/Functions/Pickups/Pos
From Liberty Unleashed Wiki
(Difference between revisions)
(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
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:
Vector pickup.Pos
pickup.Pos = Vector vPos
[edit] Arguments
- vPos - This is the new position for the pickup as a Vector
[edit] Example 1. Returning
function onPlayerCommand( player, cmd, text ) { if ( cmd == "pickuppos" ) { local pickup = FindPickup( 0 ); if ( pickup ) MessagePlayer( "Pickup 0s position is: " + pickup.Pos, player ); else MessagePlayer( "Pickup 0 does not exist", player ); } }
This command will tell the player the co-ordinates of pickup id 0.
[edit] Example 2. Setting
function onPlayerCommand( player, cmd, text ) { if ( cmd == "setpickuppos" ) { local newpos = Vector( 100.00, 90.00, 1.00 ); local pickup = FindPickup( 0 ); if ( pickup ) pickup.Pos = newpos; } }
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.