Stop The Timer
#1

How to Stop the timer? I will give example:

Код:
if(strcmp(cmd, "/start", true) == 0)
	{
    SetTimer ("Hello", 10000, false);
    }
Код:
if(strcmp(cmd, "/end", true) == 0)
     {
     //What to put to stop that "Hello" timer?
     }
Reply
#2

At the top of the script you would put something like

Код:
new HelloTimer;
Then in /start:

Код:
if(strcmp(cmd, "/start", true) == 0)
	{
    HelloTimer = SetTimer ("Hello", 10000, false);
    }
Then in /end:
Код:
if(strcmp(cmd, "/end", true) == 0)
     {
     KillTimer(HelloTimer);
     }
Reply
#3

Okay, Thanks
Reply
#4

When creating a timer, would the timer get an ID by default?
Like if I did
pawn Код:
SetTimer("myFunc", 1000 false);
Would it work if I did
pawn Код:
KillTimer(0);
if this was the only timer I'd have in the script?
Reply
#5

Yup, it will work.
Reply
#6

Than you a lot, I already did it.
Reply
#7

Quote:
Originally Posted by lrZ^ aka LarzI
When creating a timer, would the timer get an ID by default?
Like if I did
pawn Код:
SetTimer("myFunc", 1000 false);
Would it work if I did
pawn Код:
KillTimer(0);
if this was the only timer I'd have in the script?
no it will not work if you have any timers in filterscripts
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)