SA-MP Forums Archive
KillTimer with SetTimerEx - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: KillTimer with SetTimerEx (/showthread.php?tid=68354)



KillTimer with SetTimerEx - Mikep - 09.03.2009

What I need it a timer and after every 5 minutes on the server, the player gets 5 points.

I tried

new pointer[MAX_PLAYERS];

pointer[playerid] = SetTimerEx(...);

then OnPlayerDiconnect KillTimer(pointer[playerid]);

But it started to spam the 5 point timer when I relogged a few times, so it wasn't killing it.

If there a way to kill SetTimerEx?


Re: KillTimer with SetTimerEx - lesley - 09.03.2009

I thought KillTimer also works for SetTimerEx...

But, you can also try something like this:

pawn Код:
new bool:pointing[MAX_PLAYERS];
new Points[MAX_PLAYERS];

SetTimer("UpdatePoints", 30000, 1);

public UpdatePoints()
{
  for (new i=0; i<GetMaxPlayers(); i++)
  {
    if (pointing[i]) Points[i]++;
  }
}
Set "pointing[playerid]" true if you want players to get 5 ponits every 5 minutes


Re: KillTimer with SetTimerEx - Dujma - 09.03.2009

Quote:
Originally Posted by Mikep
What I need it a timer and after every 5 minutes on the server, the player gets 5 points.

I tried

new pointer[MAX_PLAYERS];

pointer[playerid] = SetTimerEx(...);

then OnPlayerDiconnect KillTimer(pointer[playerid]);

But it started to spam the 5 point timer when I relogged a few times, so it wasn't killing it.

If there a way to kill SetTimerEx?
Ex works with kill for me at least... I just tested it this morning