Pickup.Pos

From Liberty Unleashed Wiki
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events


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

Syntax

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

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

Arguments

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

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.

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).

Notes

The function FindPickup and eventonPlayerCommand was used in in this example. More info about this in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox