[Tutorial] Timers
#6

Quote:
Originally Posted by dusk
View Post
pawn Code:
timer1 ++;
    if(timer1 == 1) // 2nd number should be your timer's time / 1000, e.g. if i am running a timer at 2000 milliseconds, i will use if(timer1 == 2)
    {
    // timer 1 code
    }
Will this actually work? I mean if "timer1" is a global variable, and you increment it every time the "Global" is called, wouldn't it make the code to excecute only once? As it'll never be equal to 1 again?
Apologies for the late reply,
You can set the timer1 back to 0, e.g.
pawn Code:
timer1 ++;
    if(timer1 == 1) // 2nd number should be your timer's time / 1000, e.g. if i am running a timer at 2000 milliseconds, i will use if(timer1 == 2)
    {
           timer1 = 0; // so it can be repeated again.
    // timer 1 code
    }
Thanks for telling me anyway, I edited the post to mention this.
Reply


Messages In This Thread
Timers - by bensmart469 - 07.07.2013, 22:00
Re: Timers - by Goldilox - 08.07.2013, 07:42
Re: Timers - by Ryan_Bowe - 08.07.2013, 09:50
Re: Timers - by Eyce - 05.09.2013, 13:05
Re: Timers - by dusk - 05.09.2013, 14:47
Re: Timers - by bensmart469 - 08.09.2013, 13:55

Forum Jump:


Users browsing this thread: 1 Guest(s)