local root = getRootElement ()
local thisResourceRoot = getResourceRootElement(getThisResource())
function thisResourceStart ()
local players = getElementsByType ( "player" )
for _,this_player in ipairs(players) do
bindKey ( this_player, "lctrl", "down", stopEngine, "Motor on/off" )
end
end
function stopEngine ( player, key, state )
if getPedOccupiedVehicleSeat ( player ) == 0 then
local vehicle = getPedOccupiedVehicle ( player )
setVehicleEngineState ( vehicle, not getVehicleEngineState ( vehicle ) )
end
end
function playerJoined()
bindKey ( source, "lctrl", "down", stopEngine, "Motor on/off" )
end
addEventHandler ("onResourceStart", getRootElement(), thisResourceStart)
addEventHandler ( "onVehicleExit", stopEngine,
function ( player )
setVehicleEngineState ( source, getElementData ( source, "Motor on/off" ) )
end
)
Tente esse.