//================================================== ============================
public CountDown(playerid)
{
if(cd_sec == 0)
{
for(new i; i < MAX_PLAYERS; i++)
{
if(AccInfo[i][Frozen] == 0)
{
TogglePlayerControllable(i, 1);
}
}
PlaySound(playerid, 105

;
GameTextForAll("~r~Go! Go! Go!",1000,3);
CdStated = 0;
KillTimer(cd_timer);
}
else
{
new string[256];
PlaySound(playerid, 1057);
format(string,256,"~g~%d",cd_sec);
GameTextForAll(string,1000,3);
}
cd_sec = cd_sec-1;
return 1;
}
stock PlaySound (playerid,sound)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
PlayerPlaySound(playerid, sound, X, Y, Z);
return sound;
}
dcmd_countdown(playerid,params[])
{
#pragma unused params
if(AccInfo[playerid][Level] >= 0)
{
if(CdStated == 0)
{
new Index;
new tmp[256]; tmp = strtok(params,Index);
new tmp2[256]; tmp2 = strtok(params,Index);
if(!strlen(tmp))
return SendClientMessage(playerid, LIGHTBLUE2, "Usage: /countdown [Seconds] [Freeze 1/0]") &&
SendClientMessage(playerid, orange, "Function: Will create a CountDown for all Players! (1-Freeze, 0-NoFreeze)");
cd_sec = strval(tmp);
if(cd_sec < 1 || cd_sec > 1000)
return SendClientMessage(playerid,COLOR_WHITE,"ERROR: Seconds between 1-1000");
if(!strlen(tmp2))
return SendClientMessage(playerid, LIGHTBLUE2, "Usage: /countdown [Seconds] [Freeze 1/0]") &&
SendClientMessage(playerid, orange, "Function: Will create a CountDown for all Players! (1-Freeze, 0-NoFreeze)");
cd_f = strval(tmp2);
if(cd_f < 0 || cd_f > 1)
return SendClientMessage(playerid,red,"ERROR: Use only 0(NoFreeze) and 1(Freeze)!");
CdStated = 1;
if(cd_f == 1)
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
TogglePlayerControllable(i, 0);
}
cd_timer = SetTimer("CountDown",1000,3);
return 1;
}
else return SendClientMessage(playerid,red,"ERROR: Countdown already in Progress!");
}
else return ErrorMessages(playerid, 1);
}