SA-MP Forums Archive
How to use timer? - 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)
+--- Thread: How to use timer? (/showthread.php?tid=392974)



How to use timer? - MatZZPL - 16.11.2012

Hi, i have seen alot of different timers and stuff, but if i want to use one for like 10 commands what one would u sugest? and could you please demonstrate (show) how you would use it in a command ?

+rep for any help


Re: How to use timer? - kanersps - 16.11.2012

its like:
Код:
forward timer1();
new timer1;
timer1 = SetTimer("timer1", 1000, false)
public timer1()
{
    //Code stuff here
    return 1;
}



Re: How to use timer? - ViniBorn - 16.11.2012

pawn Код:
forward MyFunction();
public MyFunction()
{
    //Code
}


if(!strcmp(cmdtext,"/mycommand"))
{
    SetTimer("MyFunction",2000,false); //MyFunction is called after 2 seconds
    return true;
}