05.12.2010, 15:43
Okay here's a simple example so that only one timer is active at a time for the countdown.
That's just a simple example, you could also use a repeating timer with the KillTimer function.
pawn Код:
new Count = 5;
pawn Код:
if(strcmp(cmdtext,"/count",true) == 0)
{
if(Count < 5) return SendClientMessage(playerid,red,"Countdown is already in progress");
SetTimer("CountDown",1000,0);
return 1;
}
pawn Код:
public CountDown()
{
format(string,sizeof(string),"In...%d",Count);
if(Count == 0)
{
GameTextForAll("Go go go!",1500,3);
Count = 5;
}
else
{
GameTextForAll(string,1500,3);
Count--;
SetTimer("CountDown",1000,0);
}
return 1;
}