Vehicle.Pos

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

This Vehicle class member returns or sets the position of the given vehicle.

Syntax

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

  1. Vector Vehicle.Pos
  1. Vehicle.Pos = Vector vPos

Arguments

  • vPos - This is the new position for the vehicle as a vector

Example 1. Returning

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

This command will tell the player the current co-ordinates of the vehicle they are driving.

Example 2. Setting

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

This command will set the players vehicle 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