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)
+--- Thread: Timer Help (/showthread.php?tid=383731)



Timer Help - Finn707 - 08.10.2012

Hello,

Im not sure on how timers are done. I need a timer for a server tutorial, let me explain:
Players must read the tutorial, once finished reading that section they must use a command such as "/next" to move onto the next section of the tutorial. But I need a timer to make sure they read it for atleast a certain amount of time. So they can't simply spam /next and skip the tutorial.

How can I do this?


Re: Timer Help - Skillet` - 08.10.2012

Код:
new bool:next[MAX_PLAYERS];
forward next(playerid);
CMD:next(playerid,params[]) // command
{
    if(next[playerid] == false) // check if player allowed to use this command
    {
        next[playerid] = true; // set array next to true,means he used the command
        SetTimer("next", x,0); // change x with the time you want the player to wait until he can use /next again 
    }else{
       return 0; // if player isn't allowed to use this command then it will not do anything.
    }
    return 1;
}
public next(playerid)
{
    next[playerid] = false; // player allowed to use the command
}



Re: Timer Help - Finn707 - 08.10.2012

I knew there would be something for what you said ******, cheers, I will use that I guess.