Timer isn't getting killed!
#1

FIXED. Problem was in fixes.inc file which was from 2012.
Reply
#2

Set your "PlayerZoneTimer" array's default value to be -1. While setting it, if it's not equal to -1 (which means it's already active), don't call the timer. Timers can be repeating in case if duplicates are created.

pawn Код:
if(mytimer == -1)
    SetTimer(...); //else I'm not setting the timer.
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)