Dankovagabon Posted September 18, 2018 Share Posted September 18, 2018 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. Link to comment
Dimos7 Posted September 18, 2018 Share Posted September 18, 2018 (edited) function carToggleLights(player) if isPedInVehicle(player) then local veh = getPedOccupiedVehicle(player) if getVehicleOverrideLights(veh) ~= 2 then setVehicleOverrideLights(veh, 2) else setVehicleOverrideLights(veh, 1) end end end addCommandHandler("carlights", carToggleLights) Edited September 18, 2018 by Dimos7 1 Link to comment
Dimos7 Posted September 19, 2018 Share Posted September 19, 2018 (edited) If you want only driver trun on/off the Light use this and check if seat is 0 which is driver getPedOccupiedVehicleSeat Edited September 19, 2018 by Dimos7 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now