new Timer:CountDownID[MAX_PLAYERS];
new counter[MAX_PLAYERS];
StartCounter()
{
foreach(Players, i)
{
counter[i] = 4;
CountDownID[i] = repeat CountDown(i);
}
}
timer CountDown[1000](playerid)
{
SendClientMessage(playerid, -1, "timer tick"); // This just keeps going
if(counter[playerid] != 0)
{
// counting down
}
else
{
GameTextForPlayer(playerid, "~g~START!", 1000, 4);
stop CountDownID[playerid]; // this wont stop the timer
}
}
post the codes of stop CountDownID[playerid];
and also see this : CountDownID[i] = repeat CountDown(i); |
if(counter[playerid] != 0)
new counter = 5;
forward CountDown();
public CountDown()
{
if(counter > 0)
{
new str[1];
format(str, sizeof(str), "%d", counter);
GameTextForAll(str, 2000, 6);
counter--;
SetTimer("CountDown", 1000, false);
}
else
{
GameTextForAll("Go!", 2000, 6);
counter = 5;
}
return 1;
}
new counter = -1;
// OnGameModeInit
SetTimer("CountDown", 1000, true);
forward CountDown();
public CountDown()
{
if(counter > 0)
{
new str[1];
format(str, sizeof(str), "%d", counter);
GameTextForAll(str, 2000, 6);
counter--;
return 1;
}
if (counter== 0)
{
GameTextForAll("Go!", 2000, 6);
counter = -1;
return 1;
}
return 1;
}