Skip to main content

Vehicle::setEngineOn

Client-side function

Toggles the vehicle engine

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
}
});