myonlake Posted July 25, 2011 Share Posted July 25, 2011 Is there any kind of way to make the script understand disappeared vehicles. If I blow a car up, it starts giving me an error because the emergency lights were on, but the car is missing, so now it tells me the error. Now the big ASAP problem is that this spams the server, and if it spams alot, server crashes. So any help? So in another words: is there a script that disallows everything to destroy a vehicle without doing anything (disappearing just like that) OR is there a script that lets the script know that the car is missing and then it wouldn't spam the error. It says it's a bad element/vehicle pointer @ setVehicleLightState and setVehicleHeadLightColor. Now I do have few other scripts that make the lights bugged, so I have that setVehicleLightState on because of that. blueTimers = {} redTimers = {} function EmergencyLights1(source) local theVehicle = getPedOccupiedVehicle(source) if theVehicle then if getVehicleOverrideLights(theVehicle) ~= 2 then setVehicleOverrideLights(theVehicle, 2) blueTimers[theVehicle] = setTimer(setLight98, 400, 1, theVehicle) else setVehicleOverrideLights(theVehicle, 0) setVehicleHeadLightColor(theVehicle, 255, 255, 255) if isTimer(blueTimers[theVehicle]) then killTimer(blueTimers[theVehicle]) end if isTimer(redTimers[theVehicle]) then killTimer(redTimers[theVehicle]) end end end end function setLight98(car) setVehicleHeadLightColor(car, 0, 0, 255) setVehicleLightState ( car, 0, 0 ) setVehicleLightState ( car, 1, 0 ) redTimers[car] = setTimer(setLight99, 400, 1, car) end function setLight99(car) setVehicleHeadLightColor(car, 255, 0, 0) setVehicleLightState ( car, 0, 0 ) setVehicleLightState ( car, 1, 0 ) blueTimers[car] = setTimer(setLight98, 400, 1, car) end addCommandHandler("coloremergency", EmergencyLights1) Link to comment
#Paper Posted July 25, 2011 Share Posted July 25, 2011 try this blueTimers = {} redTimers = {} function EmergencyLights1(player, cmd) local theVehicle = getPedOccupiedVehicle(player) if theVehicle then if getVehicleOverrideLights(theVehicle) ~= 2 then setVehicleOverrideLights(theVehicle, 2) blueTimers[theVehicle] = setTimer(setLight98, 400, 1, theVehicle) else setVehicleOverrideLights(theVehicle, 0) setVehicleHeadLightColor(theVehicle, 255, 255, 255) if isTimer(blueTimers[theVehicle]) then killTimer(blueTimers[theVehicle]) end if isTimer(redTimers[theVehicle]) then killTimer(redTimers[theVehicle]) end end end end function setLight98(car) setVehicleHeadLightColor(car, 0, 0, 255) setVehicleLightState ( car, 0, 0 ) setVehicleLightState ( car, 1, 0 ) redTimers[car] = setTimer(setLight99, 400, 1, car) end function setLight99(car) setVehicleHeadLightColor(car, 255, 0, 0) setVehicleLightState ( car, 0, 0 ) setVehicleLightState ( car, 1, 0 ) blueTimers[car] = setTimer(setLight98, 400, 1, car) end addCommandHandler("coloremergency", EmergencyLights1) 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