Vehicle::setEngineOn

From RAGE Multiplayer Wiki
Jump to navigation Jump to search

Client-Side
Function

Js.png JavaScript



Toggles the vehicle engine

JavaScript Syntax
Jslogo.png

Syntax

vehicle.setEngineOn(toggle, instantly, otherwise);

Required Arguments

  • *toggle: Boolean
  • *instantly: Boolean (Turns the engine instantly)
  • *otherwise: Boolean (Prevents player from manually toggling the engine)

Return value

  • void

Example

Client-Side
mp.events.add('playerStartEnterVehicle', (vehicle, seat) => { 
    if (!vehicle.getIsEngineRunning()) {
        vehicle.setEngineOn(false, false, true); // Turns Engine off once enter the vehicle to prevent player from toggling the engine manually
    }
});


See also