Vehicle.Angle

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 rotation of the vehicle.

Syntax

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

  1. float Vehicle.Angle
  1. Vehicle.Angle = float fAngle

Arguments

  • vPos - This is the new rotation of the vehicle in degrees

Example 1. Returning

This command will show the player the angle of the vehicle that they are currently in.

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "vehangle" )
  5. {
  6. local veh = player.Vehicle;
  7. if ( veh ) MessagePlayer( "Vehicle angle: " + veh.Angle, player );
  8. }
  9. return 1;
  10. }
  11.  

Notes

The functions Player.Vehicle, MessagePlayer and event onPlayerCommand were used in this example. More info about them in the corresponding pages.

Example 2. Setting

This command will set the players vehicle angle to the angle specified in the text.

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "vehangle" )
  5. {
  6. local veh = player.Vehicle;
  7. if ( ( veh ) && ( text ) ) veh.Angle = text.tofloat();
  8. }
  9. return 1;
  10. }
  11.  

Notes

The function Player.Vehicle and event onPlayerCommand were used in this example. More info about them in the corresponding pages.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox