getVehicleEngineState | Multi Theft Auto: Wiki Skip to content

getVehicleEngineState

Client-side
Server-side
Shared

Pair: setVehicleEngineState

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 returns a vehicle's engine state (on or off).

Syntax

getVehicleEngineState ( )

Code Examples

server

This example will switch the vehicle engine state with the command "/switchengine".

function switchEngine ( playerSource )
local theVehicle = getPedOccupiedVehicle ( playerSource )
-- Check if the player is in any vehicle and if he is the driver
if theVehicle and getVehicleController ( theVehicle ) == playerSource then
local state = getVehicleEngineState ( theVehicle )
setVehicleEngineState ( theVehicle, not state )
end
end
addCommandHandler ( "switchengine", switchEngine )

See Also

Vehicle Functions