14.07.2015, 14:33
I myself never used KillTimer because I dont trust it. I've noticed in the past that it doesnt always work. It's a known bug and after 8 years I'm very dissapointed to hear its still not fixed.
How I used to do it is set a variable in the callback of the timer and keep setting the timer over and over again. Once the variable isnt 1 anymore it wouldnt set the timer anymore. If that makes sense to you?
So basically:
Ofcourse you can make it player bound aswel with [MAX_PLAYERS], in that case you have to use SetTimerEx to get the playerid.
Basically at the spot you set the timer dont forget to set the TimerVar(so when he enters the zone):
Then your stuff(im not gonna fully copy and paste it though):
Then at the spot you placed KillTimer, simply Set the TimerVar = 0; and it stops the timer.
How I used to do it is set a variable in the callback of the timer and keep setting the timer over and over again. Once the variable isnt 1 anymore it wouldnt set the timer anymore. If that makes sense to you?
So basically:
pawn Код:
new TimerVar;
Basically at the spot you set the timer dont forget to set the TimerVar(so when he enters the zone):
pawn Код:
SetTimer("GangCount", 1000, false, "iis", playerid, checkpointid, zonename);
TimerVar = 1;
pawn Код:
forward GangCount(playerid, checkpointid, zonename);
public GangCount(playerid, checkpointid, zonename)
{
If TimerVar == 1
{
SetTimer("GangCount", 1000, false, "iis", playerid, checkpointid, zonename);
}
Your stuff here
}