Timer isn't getting killed!
#3

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:
pawn Код:
new TimerVar;
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):
pawn Код:
SetTimer("GangCount", 1000, false, "iis", playerid, checkpointid, zonename);
TimerVar = 1;
Then your stuff(im not gonna fully copy and paste it though):
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
}
Then at the spot you placed KillTimer, simply Set the TimerVar = 0; and it stops the timer.
Reply


Messages In This Thread
Timer isn't getting killed! - by Dan. - 14.07.2015, 14:09
Re: Timer isn't getting killed! - by Lordzy - 14.07.2015, 14:22
Re: Timer isn't getting killed! - by notime - 14.07.2015, 14:33

Forum Jump:


Users browsing this thread: 1 Guest(s)