Countdown Bug.
#4

Try to use this, i fixed it a little bit.
Your mistake was:

> Starting Timer more then one time, for everyone near you.
> Resetting the Timer if someone is near you (that bugs arround for you)

pawn Код:
new Timer_Countdown;
new CountDown_Time;

command(countdown,playerid,params[])
{
    CountDown(playerid, 3);
    return 1;
}

forward CountDown(playerid, seconds);
public CountDown(playerid, seconds)
{
    if(seconds > 0)
    {
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
       
        CountDown_Time = seconds;
        CountDownThink(X,Y,Z);
        KillTimer(Timer_Countdown);
        Timer_Countdown = SetTimerEx("CountDownThink", 1000,true, "fff", X,Y,Z);
       
        return 1;
    }
    return 1;
}

forward CountDownThink(Float:X,Float:Y,Float:Z);
public CountDownThink(Float:X,Float:Y,Float:Z)
{
    new string[50];
    new seconds = CountDown_Time;
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerInRangeOfPoint(i, 40, X, Y, Z))
        {
            if(seconds == 0)
            {
                PlayerPlaySound(i, 1057, X, Y, Z);
                GameTextForPlayer(i, "~G~Go!", 1000, 3);
            }
            else
            {
                PlayerPlaySound(i, 1056, X, Y, Z);
                format(string, sizeof(string), "~b~%d", seconds);
                GameTextForPlayer(i, string, 1000, 3);
                CountDown_Time = seconds -1;
            }
        }
    }
    if (seconds == 0)
    {
        KillTimer(Timer_Countdown);
    }
}
This is my fixed version ^-^.
Reply


Messages In This Thread
Countdown Bug. [FIXED] - by TyThaBomb - 27.06.2012, 08:54
Re: Countdown Bug. - by Slaykler - 27.06.2012, 09:35
Re: Countdown Bug. - by [MM]RoXoR[FS] - 27.06.2012, 09:49
AW: Countdown Bug. - by LadyNyuuu - 27.06.2012, 09:55
Re: AW: Countdown Bug. - by TyThaBomb - 28.06.2012, 01:31
Re: Countdown Bug. - by [KHK]Khalid - 28.06.2012, 01:47
Respuesta: Countdown Bug. - by Chris1337 - 28.06.2012, 02:09
Re: Respuesta: Countdown Bug. - by [KHK]Khalid - 28.06.2012, 02:15

Forum Jump:


Users browsing this thread: 1 Guest(s)