Hi! I recently got into scripting so I'm not really sure about what I am doing.
So I wanted to create a command that toggles the car lights, but I just can't make it work.
function carToggleLights(player, cmd)
local driving, vehicle = isPedDrivingVehicle(player)
if driving then
if getVehicleOverrideLights(vehicle) ~= 2 then
setVehicleOverrideLights(vehicle, 2)
else
setVehicleOverrideLights(vehicle, 1)
end
end
end
addCommandHandler('carlights', carToggleLights)
I would greatly appreciate if someone told me how to solve this issue.