function consoleVehicleLights ()
if isPedInVehicle(getLocalPlayer()) then -- checks is the player in vehicle if yes, then:
playerVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) -- get the local player's vehicle
if ( playerVehicle ) then -- if he was in one
if ( getVehicleOverrideLights ( playerVehicle ) ~= 2 ) then -- if the current state isn't 'force on'
setVehicleOverrideLights ( playerVehicle, 2 ) -- force the lights on
else
setVehicleOverrideLights ( playerVehicle, 1 ) -- otherwise, force the lights off
end
end
end
end
function PlayerOnS ()
bindKey(source,"L","down",consoleVehicleLights)
end
addEventHandler("onPlayerJoin",root,PlayerOnS)
function JogadoresOnJ ()
local jogadores = getElementsByType ("player")
for k,v in ipairs(jogadores) do
bindKey(v,"F2","down",consoleVehicleLights)
end
end
JogadoresOnJ()
Tentei fazer um script com bindKey mas não deu certo, Alguém pode me ajudar ?
debug script: WARNING: Bad argument @'bindKey' [Expected string at argument 1, got player]