new Countdown; new CountdownSecs; if(strcmp(cmd, "/countdown", true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /countdown [seconds 3-10]"); return 1; } moneys1 = strval(tmp); if (Countdown) { SendClientMessage(playerid, COLOR_RED, "A countdown is already taking place"); return 1; } if (2 < moneys1 && moneys1 < 11) { Countdown = true; CountdownSecs = moneys1; SetTimer("CountdownTime",1500,1); format(string, sizeof(string), "~y~%d", moneys1); GameTextForAll(string, 1600, 4); for (new i = 0; i < MAX_PLAYERS; i++) { new Float:X, Float:Y, Float:Z; GetPlayerPos(i, X,Y,Z); PlayerPlaySound(i, 1056, X,Y,Z); } return 1; } else { SendClientMessage(playerid, COLOR_WHITE, "The countdown duration must be within 3-10 seconds"); } return 1; } public CountdownTime() { new string[256]; for (new i = 0; i < MAX_PLAYERS; i++) { if (Countdown) { CountdownSecs --; if (CountdownSecs > 0) { format(string, sizeof(string), "~y~%d", CountdownSecs); GameTextForAll(string, 1600, 4); new Float:X, Float:Y, Float:Z; GetPlayerPos(i, X,Y,Z); PlayerPlaySound(i, 1056, X,Y,Z); } if (CountdownSecs == 0) { GameTextForAll("~g~GO!", 1500, 3); new Float:X, Float:Y, Float:Z; GetPlayerPos(i, X,Y,Z); PlayerPlaySound(i, 1057, X,Y,Z); Countdown = false; KillTimer(CountdownTime()); } } } return 1; }