thnx,
My light and engine script doesn't work. WHY?
addEvent ( "bindKeys",true )
addEventHandler ( "bindKeys", getRootElement(),
function()
-- Initilize Player Element Data
local players = getElementsByType ( "player" )
for k,p in ipairs(players) do
if player == source then
bindKey ( "f", "down", engineOffOn )
bindKey( "l", "down", changeLightsState )
end
end
end
)
addEvent ( "unbindKeys",true )
addEventHandler ( "unbindKeys", getRootElement(),
function()
-- Initilize Player Element Data
local players = getElementsByType ( "player" )
for k,p in ipairs(players) do
if player == source then
unbindKey ( "f", "down", engineOffOn )
unbindKey( "l", "down", changeLightsState )
end
end
end
)
function engineOffOn()
local vehicle = getPedOccupiedVehicle( source )
if leftseat == 1 then
setVehicleEngineState ( vehicle, false )
else
setVehicleEngineState ( vehicle, true )
end
end
function changeLightsState()
local vehicle = getPedOccupiedVehicle( source )
if leftseat == 1 then
setVehicleOverrideLights( vehicle, 2 )
else
setVehicleOverrideLights( vehicle, 1 )
end
end