[Solved] Will This Work? (Killing Timers)
#1

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?
Reply
#2

It will most likely only kill the last timer that you set
Reply
#3

So I need to set up like
pawn Код:
new timer1, timer2, timer3...
for every timers and then kill
pawn Код:
KillTimer(timer1);
KillTimer(timer2);
KillTimer....
?
Reply
#4

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]);
}
Reply
#5

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")
Reply
#6

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..
Reply
#7

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
Reply
#8

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
Reply
#9

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)