18.05.2020, 00:31
PHP Code:
new CountDown = -1;
forward countdown();
public countdown()
{
if(CountDown == 6) GameTextForAll("~p~Starting...", 1000, 6);
CountDown--;
if(CountDown == 0)
{
GameTextForAll("~g~GO~ r~!", 1000, 6);
CountDown = -1;
for(new i = 0; i < MAX_PLAYERS; i++) {
TogglePlayerControllable(i, true);
PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
}
return 0;
}
else
{
new text[7]; format(text, sizeof(text), "~w~%d", CountDown);
for(new i = 0; i < MAX_PLAYERS; i++) {
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
TogglePlayerControllable(i, false);
}
GameTextForAll(text, 1000, 6);
}
SetTimer("countdown", 1000, 0);
return 0;
}
CMD:countdown(playerid, params[]) {
if(PlayerInfo[playerid][Level] >= 4) {
if(CountDown == -1) {
CountDown = 6;
SetTimer("countdown", 1000, 0);
return CMDMessageToAdmins(playerid, "COUNTDOWN");
} else return SendClientMessage(playerid, red, "ERROR: Countdown in progress");
} else return SendClientMessage(playerid, red, "ERROR: You are not a high enough level to use this command");
}
I think I can use IsPlayerInRangeOfPoint but it would do the countdown just to the one nearest person (i guess)
EDIT: Or I can just use ProxDetector ? But idk how