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



Countdown timer? - RALL0 - 17.08.2013

Hey, I wonder how can I make a countdown with GameTextForPlayer?


Re: Countdown timer? - Naruto_Emilio - 17.08.2013

use it with timers while calling the commandd or function of countdown


Re: Countdown timer? - xganyx - 17.08.2013

I ask this question 1 time now i'll teach you

pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>

new countac,
    countam,
    counttime;

forward Count();

CMD:count(playerid,params[])
{
    new am;
    if(sscanf(params,"i",am)) return SendClientMessage(playerid,-1,"USAGE: /count [second]");
    counttime = SetTimer("Count",2000,true);
    countam = am;
    countac = 1;
    return 1;
}

public Count()
{
    if(!countac)
    {
        KillTimer(counttime);
    }
    else
    {
        new tstring[128];
        format(tstring,sizeof(tstring),"Counting Down: %i",countam);
        GameTextForAll(tstring,1000,3);
        countam --;
        if(countam == 0)
        {
            countac = 0;
            GameTextForAll("~g~~h~Go!",1000,3);
        }
    }
    return 1;
}