setTimer returns timer variable, and this is what you need to kill..
before you copy-paste it without reading:
this will fail on server side (if 2 players activate it - one player timers won't stop)
will work fine on client
for server you need to create a table with timers like:
timers1 = { }
then set/kill timer like that:
timers1[playerElement] = setTimer (blabla)
--and kill
killTimer(timers1[playerElement])
where playerElement is .. your player element
function EmergencyLights ( source )
theVehicle = getPlayerOccupiedVehicle ( source )
if ( theVehicle ) then
if ( getVehicleOverrideLights ( theVehicle ) ~= 2 ) then
setVehicleOverrideLights ( theVehicle, 2 )
setTimer ( setLight, 400, 1 )
else
setVehicleOverrideLights ( theVehicle, 0 )
killTimer ( timer1 )
killTimer ( timer2 )
end
end
end
function setLight ( )
setTimer ( setLight2, 400, 1 )
timer1 = setVehicleHeadLightColor (theVehicle, 000, 000, 255)
end
function setLight2 ( )
setVehicleHeadLightColor (theVehicle, 255, 000, 000)
timer2 = setTimer ( setLight, 400, 1 )
end
addCommandHandler ( "elights", EmergencyLights )