[HELP] timer won't destroy(kill) - 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)
+--- Thread: [HELP] timer won't destroy(kill) (
/showthread.php?tid=464604)
[HELP] timer won't destroy(kill) -
Luca12 - 17.09.2013
Hello I make something about call with timer and know when I hangup(/h) then timer timer supose to kill but it doesn't it stay if you know what I mean? I use KillTimer(call[playerid]);
Re: [HELP] timer won't destroy(kill) -
EiresJason - 18.09.2013
Do you have this code under the command /h?
Re: [HELP] timer won't destroy(kill) -
Sgt.TheDarkness - 18.09.2013
You should use the method below to destroy a SA:MP timer, at least this is how I've always done it
This should work:
Код:
new YourTimerName;
YourTimerName = SetTimer("YourTimerCallback", 1000, true); //Replace these arguments
KillTimer(YourTimerName);
Re: [HELP] timer won't destroy(kill) -
EiresJason - 18.09.2013
Nah, it's best to do it per player incase you want to set timers for players.
pawn Код:
new YourTimerName[MAX_PLAYERS];
YourTimerName[playerid] = SetTimerEx("YourTimerCallback", 1000, true, "i", playerid); //if YourTimerCallback has a parameter like public YourTimerCallback(playerid).
KillTimer(YourTimerName[playerid]);
Re: [HELP] timer won't destroy(kill) -
Sgt.TheDarkness - 18.09.2013
Oopsie, I misread his above post, I didn't realize it was for a certain player, it's 1:34 AM here and I'm extremely tired, but your code would work just as-well.