Help with timers..
#1

Ok, I have this example:

pawn Код:
new count;
new timer1;
new timer2;

timer1 = SetTimer("Timer1", 1000, 1);

forward Timer1();
public Timer1()
{
    count++;
    if(count > 10)
    {
        KillTimer(timer1);
        timer2 = SetTimer("Timer2", 500, 1);
        printf("called 1");
    }
}

forward Timer2();
public Timer2()
{
    printf("called 2");
    //stuff here..
}
So, in my console 'called 1' get's printed, but 'called 2' doesn't.. so the timer isn't working correctly.. any ideas?
Reply
#2

Try This:

Код:
new count;
new timer1;
new timer2;

forward Timer1();
forward Timer2();

timer1 = SetTimer("Timer1", 1000, 1);

public Timer1()
{
    count++;
    if(count > 10)
    {
        KillTimer(timer1);
        timer2 = SetTimer("Timer2", 500, 1);
        printf("called 1");
    }
}

public Timer2()
{
    printf("called 2");
    //stuff here..
}
Reply
#3

You ALWAYS have to forward it.. if not.. you get a really annoying warning..

Anyway, I solved it.. it was my bad..

Thanks anyway
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)