Vehicle.OneTime

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

This Vehicle class member returns whether the vehicle is a one time only vehicle (meaning it will be deleted after it has been exploded).

Syntax

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

  1. bool Vehicle.OneTime
  1. Vehicle.OneTime = bool enabled

Arguments

  • enabled - A boolean representing whether the vehicle should be deleted after its destruction or not

Example 1. Returning

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "onetime" )
  5. {
  6. if ( pPlayer.Vehicle ) MessagePlayer( "Vehicle one time only is set to " + pPlayer.Vehicle.OneTime, pPlayer );
  7. }
  8. return 1;
  9. }
  10.  

Notes

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

Example 2. Setting

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "veh" )
  5. {
  6. local pVehicle = CreateVehicle( VEH_INFERNUS, pPlayer.Pos, pPlayer.Angle, -1, -1 );
  7. if ( pVehicle ) pVehicle.OneTime = true;
  8. }
  9. return 1;
  10. }
  11.  

Notes

The functions MessagePlayer and CreateVehicle 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