24.04.2014, 12:23
So what I'm trying to do, spawn all players at a random point, (the random points are in a circle in a mapped stadium) and then freeze and start the countdown, after the countdown ends, unfreeze. I'm trying to make it work for all. Like, it brings all players, and show the countdown to all, and unfreeze / freeze all.
pawn Код:
COMMAND:start(playerid, params[])
{
new rand = random(sizeof(pRandomSpawns));
SetPlayerPos(playerid, pRandomSpawns[rand][0], pRandomSpawns[rand][1], pRandomSpawns[rand][2]);
TogglePlayerControllable(playerid, false);
cd_sec = 5;
cd_timer = SetTimer("countdown", 999, 1);
return 1;
}
pawn Код:
forward countdown(playerid);
public countdown(playerid)
{
if(cd_sec == 0)
{
GameTextForAll("~r~Go!",1000,3);
TogglePlayerControllable(playerid, true);
KillTimer(cd_timer);
}
else
{
new string[8];
format(string,sizeof(string),"~g~%d",cd_sec);
GameTextForAll(string,1000,3);
}
cd_sec = cd_sec-1;
return 1;
}