SA-MP Forums Archive
Help with 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: Help with timers.. (/showthread.php?tid=185500)



Help with timers.. - The_Moddler - 24.10.2010

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?


Re: Help with timers.. - Camacorn - 24.10.2010

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..
}



Respuesta: Help with timers.. - The_Moddler - 24.10.2010

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

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

Thanks anyway