Countdown Bug.
#1

Err, so I may have posted something similar to this earlier, but I've got a new bug.

I do /countdown, it counts down fine, but if someone else is near, it bugs the timer, affecting the countdown.
(Yes, I'm trying to get it to where if a player is near it counts down for them too.)

Here's the code, thanks in advance.

pawn Код:
command(countdown,playerid,params[])
{
    CountDown(playerid, 3);
    return 1;
}

forward CountDown(playerid, seconds);
public CountDown(playerid, seconds)
{
    new string[50];
    if(seconds > 0)
    {
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        for(new i=0;i<MAX_PLAYERS;i++) {
            if(IsPlayerInRangeOfPoint(i, 40, X, Y, Z)) {
                PlayerPlaySound(i, 1056, X, Y, Z);
                format(string, sizeof(string), "~b~%d", seconds);
                GameTextForPlayer(i, string, 1000, 3);
                seconds = seconds -1;
                SetTimerEx("CountDown", 1000, 0, "ii", playerid, seconds);
            }
        }
        return 1;
    }
    if(seconds == 0)
    {
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        for(new i=0;i<MAX_PLAYERS;i++) {
            if(IsPlayerInRangeOfPoint(i, 40, X, Y, Z)) {
                PlayerPlaySound(playerid, 1057, X, Y, Z);
                GameTextForPlayer(playerid, "~G~Go!", 1000, 3);
            }
        }
        return 1;
    }
    return 1;
}
LadyNyuuu's post was correct, I made a noob error.
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)