SA-MP Forums Archive
timer help - 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: timer help (/showthread.php?tid=160054)



timer help - iJumbo - 15.07.2010

how to make a timer switch some items not random like 1 - 2 - 3 - 4 - 5 - 6 - 7 then when timer go to 7 start to 1 and make again 1 - 2 - 3 - 4 - 5 - 6 - 7 in progressive


Re: timer help - Jeffry - 15.07.2010

At TOP of your script:
pawn Код:
new Number=0;
Where you want to start the Timer (Mostly at OnGameModeInit):
pawn Код:
SetTimer("YourTimer", 20000, 1); //Timer gets called every 20 secs
The Function:
pawn Код:
forward YourTimer();
public YourTimer()
{
    switch(Number)
    {
    case 0: { SendClientMessageToAll(0xFFFFFFFF, "Case 0!"); Number++; }
    case 1: { SendClientMessageToAll(0xFFFFFFFF, "Case 1!"); Number++; }
    //....
    case 7: { SendClientMessageToAll(0xFFFFFFFF, "Case 7!"); Number=0; } // Make "=0" at the LAST case.
    }
    return 1;
}
I hope this helps you.

Greetz,
Jeffry