[Solved] Will This Work? (Killing Timers) - 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: [Solved] Will This Work? (Killing Timers) (
/showthread.php?tid=86049)
[Solved] Will This Work? (Killing Timers) -
SiJ - 11.07.2009
Hey,
If I do something like this:
pawn Код:
new timers;
timers = SetTimer("name",5000,0);
timers = SetTimer.....
timers = SetTimer...
And on the another public:
KillTimer(timers);
?
Will it kill all
timers?
Re: Will This Work? (Killing Timers) -
lavamike - 11.07.2009
It will most likely only kill the last timer that you set
Re: Will This Work? (Killing Timers) -
SiJ - 11.07.2009
So I need to set up like
pawn Код:
new timer1, timer2, timer3...
for every timers and then kill
pawn Код:
KillTimer(timer1);
KillTimer(timer2);
KillTimer....
?
Re: Will This Work? (Killing Timers) -
-Sneaky- - 11.07.2009
That will probarly kill the latest timer yes, do this instead:
pawn Код:
new timers[3];
timers[0] = SetTimer("name",5000,0);
timers[1] = SetTimer.....
timers[2] = SetTimer...
for(new t = 0; t < sizeof(timers); t++)
{
KillTimer(timers[t]);
}
Re: Will This Work? (Killing Timers) -
SiJ - 11.07.2009
Quote:
Originally Posted by # Sleepy
That will probarly kill the latest timer yes, do this instead:
pawn Код:
new timers[3]; timers[0] = SetTimer("name",5000,0); timers[1] = SetTimer..... timers[2] = SetTimer...
for(new t = 0; t < sizeof(timers); t++) { KillTimer(timers[t]); }
|
Oh.. that doesn't work...
error 033: array must be indexed (variable "Timers")
Re: Will This Work? (Killing Timers) -
abhinavdabral - 11.07.2009
Quote:
Originally Posted by Justas [SiJ
]
So I need to set up like
pawn Код:
new timer1, timer2, timer3...
for every timers and then kill
pawn Код:
KillTimer(timer1); KillTimer(timer2); KillTimer....
?
|
This will work ... I am 100% sure. .... i have done like this in my server too..
Re: Will This Work? (Killing Timers) -
SiJ - 11.07.2009
Quote:
Originally Posted by ۞●•λвнiиаv•●۞
Quote:
Originally Posted by Justas [SiJ
]
So I need to set up like
pawn Код:
new timer1, timer2, timer3...
for every timers and then kill
pawn Код:
KillTimer(timer1); KillTimer(timer2); KillTimer....
?
|
This will work ... I am 100% sure. .... i have done like this in my server too.. 
|
I think I'll do this, but I have like 10 timers which has to be killed at the same time so it will be many work... :S
Re: Will This Work? (Killing Timers) -
lavamike - 11.07.2009
Make sure you put: new timers[3]; at the top of your script, normally by your defines and #includes.
and make sure you keep the same casing:
pawn Код:
new timers[3];
tIMERs[0] = ... // Wrong
timErS[1] = ... // Wrong
timers[2] = ... // Correct
Re: Will This Work? (Killing Timers) -
SiJ - 11.07.2009
Quote:
Originally Posted by Lavamike
Make sure you put: new timers[3]; at the top of your script, normally by your defines and #includes.
and make sure you keep the same casing:
pawn Код:
new timers[3];
tIMERs[0] = ... // Wrong timErS[1] = ... // Wrong timers[2] = ... // Correct
|
Yeah, I did everything you said..
But anyway I've already done everything with
new timer1, timer2.. method

Thanks for help