setVehicleEngineState | Multi Theft Auto: Wiki Skip to content

setVehicleEngineState

Client-side
Server-side
Shared

Pair: getVehicleEngineState

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function turns a vehicle's engine on or off. Note that the engine will always be turned on when someone enters the driver seat, unless you override that behaviour with scripts.

Syntax

setVehicleEngineState ( )

Code Examples

server

This example lets the driver toggle vehicle engine on/off.

function toggleEngine()
local vehicle = getPedOccupiedVehicle(localPlayer)
if vehicle and getVehicleController(vehicle) == localPlayer then
setVehicleEngineState(vehicle, not getVehicleEngineState(vehicle))
end
end
addCommandHandler("engine", toggleEngine)

See Also

Vehicle Functions