SA-MP Forums Archive
/countdown cmd? - 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 cmd? (/showthread.php?tid=490094)



/countdown cmd? - PAF - 25.01.2014

plz give me the script of /countdown command


Re: /countdown cmd? - gtascripterultimate - 26.01.2014

Quote:
Originally Posted by PAF
Посмотреть сообщение
plz give me the script of /countdown command
forwards in your script:

forward Counting(playerid);
forward Counting2(playerid);
forward Counting1(playerid);
forward CountingGO(playerid);

Publics in your script:

public Counting(playerid)
{
Count = 1;
GameTextForAll("~r~3",1000,3);
SetTimer("Counting2",1000,false);
return 1;
}
public Counting2(playerid)
{
Count = 1;
GameTextForAll("~r~2",1000,3);
SetTimer("Counting1",1000,false);
return 1;
}
public Counting1(playerid)
{
Count = 1;
GameTextForAll("~r~1",1000,3);
SetTimer("CountingGO",1000,false);
return 1;
}
public CountingGO(playerid)
{
Count = 0;
GameTextForAll("~g~STARTAS",1000,3);
for(new i=0; i < MAX_PLAYERS; i++)
return 1;
}

CMD:countdown(playerid,params[])
{
new Float: x,Float:y,Float:z;
GetPlayerPos(playerid, x, y, z);
if (Count == 0)
{
SetTimer("Counting",1000,false);
}else{
SendClientMessage(playerid, 0xFF0000FF,"Countdown started!");
}
return 1;
}


Re: /countdown cmd? - Abagail - 26.01.2014

You'll have to use a timer as shown in the code above.


Re: /countdown cmd? - lHesoyaml - 26.01.2014

Not tested test and tell me if it worked
pawn Код:
new timec;

CMD:countdown(playerid, params[])
{
if(sscanf(params, "i", timec)) return SendClientMessage( playerid, -1, "/countdown [time]" );
if((timec < 1) || (timec > 20)) return SendClientMessage(playerid, -1, "Time 20!");
TimerCont = SetTimer("DTime", 1000, true);
return 1;
}

public DTime()
{
    if(timec == 0)
    {
        KillTimer(TimerCont);
        GameTextForAll("~r~Go Go Go", 1000, 6);
        return 1;
    }
    format(String, sizeof(String), "~g~%d", timec);
    GameTextForAll(String, 1000, 6);
    timec--;
    return 1;
}