Display countdown
#2

Okay here's a simple example so that only one timer is active at a time for the countdown.

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;
}
That's just a simple example, you could also use a repeating timer with the KillTimer function.
Reply


Messages In This Thread
Display countdown - by knackworst - 05.12.2010, 15:34
Re: Display countdown - by JaTochNietDan - 05.12.2010, 15:43
Re: Display countdown - by knackworst - 05.12.2010, 15:47
Re: Display countdown - by JaTochNietDan - 05.12.2010, 15:50
Re: Display countdown - by knackworst - 05.12.2010, 15:53
Re: Display countdown - by JaTochNietDan - 05.12.2010, 15:55
Re: Display countdown - by knackworst - 05.12.2010, 16:07
Re: Display countdown - by JaTochNietDan - 05.12.2010, 16:09
Re: Display countdown - by knackworst - 05.12.2010, 16:13

Forum Jump:


Users browsing this thread: 4 Guest(s)