29.11.2009, 21:29
Nah, this one is way better... i use it in sLK clan server.
I think it was written by Donny_K
pawn Код:
forward CountDown(num);
new CountRunning =0;
pawn Код:
dcmd_cd(playerid, params[])
{
if (!strlen(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cd [time]");
else if(CountRunning) return SendClientMessage(playerid, COLOR_RED, "There is already a countdown running.");
else if(!IsNumeric(params)) return SendClientMessage(playerid, COLOR_RED, "The [amount] param must be numerical");
else if (strval(params) < 1) return SendClientMessage(playerid, COLOR_RED, "The count has to be greater than zero");
else if (strval(params) > 10) return SendClientMessage(playerid, COLOR_RED, "The count can't be higher than 10!");
else
{
CountRunning = 1;
new ii = strval(params);
do
{
SetTimerEx("CountDown", (strval(params) - ii) * 1000, false, "i", ii);
ii --;
}
while (ii != -1);
SendClientMessage(playerid, COLOR_WHITE, "***CountDown Started***");
}
return 1;
}
pawn Код:
public CountDown(num)
{
new str[2];
if (num)
{
format(str, sizeof(str), "%i", num);
GameTextForAll(str, 1001, 5);
}
else
{
GameTextForAll("~g~Go", 3000, 5);
CountRunning = 0;
}
}