Local Countdown
#10

Why so fkin' many loops?

I don't like the way this your countdown-system works, but tried my best:

pawn Код:
forward countdown(playerid);
public countdown(playerid)
{
    if(CountDown != -1)
    {
        new text[32];
        if(CountDown == 6) // Countdown starting..
        {
            format(text, sizeof(text), "~p~Starting...");
            CountDown--;
        }
        else if(CountDown == 0) // Countdown ended..
        {
            format(text, sizeof(text), "~g~GO ~r~!");
            CountDown = -1;
        }
        else // Countdown in action..
        {
            format(text, sizeof(text), "~w~%d", CountDown);
            CountDown--;
        }

        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(GetDistanceBetweenPlayers(playerid, i) < 8.0)
            {
                if(CountDown == 6) // Countdown starting..
                {
                    PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
                    TogglePlayerControllable(i, false);
                }
                else if(CountDown == 0) // Countdown ended..
                {
                    PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
                    TogglePlayerControllable(i, true);
                }

                GameTextForPlayer(i, text, 1000, 6);
            }
        }

        SetTimerEx("countdown", 1000, false, "i", playerid);
    }
    return 1;
}
It works, or not.
Reply


Messages In This Thread
Local Countdown - by [KMA]DlennartD - 01.08.2010, 01:08
Re: Local Countdown - by Kar - 01.08.2010, 01:13
Re: Local Countdown - by [KMA]DlennartD - 01.08.2010, 01:31
Re: Local Countdown - by Kar - 01.08.2010, 01:44
Re: Local Countdown - by Calgon - 01.08.2010, 01:45
Re: Local Countdown - by [KMA]DlennartD - 04.08.2010, 09:47
Re: Local Countdown - by Kar - 04.08.2010, 13:58
Re: Local Countdown - by [KMA]DlennartD - 04.08.2010, 20:34
Re: Local Countdown - by ikey07 - 04.08.2010, 20:36
Re: Local Countdown - by Finn - 04.08.2010, 22:31

Forum Jump:


Users browsing this thread: 3 Guest(s)