20.11.2012, 20:59
Ok so I have a command that will turn vehicles lights on and off constantly. I wanted the same command thatturns them on to also turn them off, but I must have made a mistake becuase when I do it again it just adds another timer (they flash faster)... Here is what I have:
And under the playerentervehicle part in my script I have this:
So what do I need to do/fix?
pawn Код:
if(!strcmp(cmd, "/hazard", true))//hazard lights
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
new newcar = GetPlayerVehicleID(playerid);
if(CarFlasher[newcar] == 0)
{
CarFlasher[newcar] = SetTimer("Flashers", 1000, true);
CarFlasher[newcar] = 1;
}
if(CarFlasher[newcar] == 1)
{
KillTimer(CarFlasher[newcar]);
CarFlasher[newcar] = 0;
}
}
}
}
pawn Код:
CarFlasher[newcar] = 0;