Timer doesn't work with my /countdown
#2

Hi Reklez,

I see a few issues, the first one being this line:
pawn Код:
SetTimer("Countdown", 1000, false);
The "Countdown" function expects a "playerid" parameter. However none is passed when using this timer. May I suggest adapting your countdown functions to the following:

pawn Код:
public Countdown()
{
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
    {
        if(IsPlayerConnected(playerid))
        {
            if(Player[playerid] == 1)
            {
                GameTextForAll("~r~5",1000,6);
                PlayerPlaySound(playerid, 1056, 0, 0, 0);
                SetTimer("Countdown2",1000,false);
            }
           
        }
    }
    return 1;
}

public Countdown2()
{
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
    {
        if(IsPlayerConnected(playerid))
        {
            if(Player[playerid] == 1)
            {
                GameTextForAll("~r~4",1000,6);
                PlayerPlaySound(playerid, 1056, 0, 0, 0);
                SetTimer("Countdown3",1000,false);
            }
        }
    }
    return 1;
}

public Countdown3()
{
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
    {
        if(IsPlayerConnected(playerid))
        {
            if(Player[playerid] == 1)
            {
                GameTextForAll("~r~3",1000,6);
                PlayerPlaySound(playerid, 1056, 0, 0, 0);
                SetTimer("Countdown4",1000,false);
            }
        }
    }
    return 1;
}

public Countdown4()
{
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
    {
        if(IsPlayerConnected(playerid))
        {
            if(Player[playerid] == 1)
            {
                GameTextForAll("~r~2",1000,6);
                PlayerPlaySound(playerid, 1056, 0, 0, 0);
                SetTimer("Countdown5",1000,false);
            }
        }
    }
    return 1;
}

public Countdown5()
{
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
    {
        if(IsPlayerConnected(playerid))
        {
            if(Player[playerid] == 1)
            {
                GameTextForAll("~r~1",1000,6);
                PlayerPlaySound(playerid, 1056, 0, 0, 0);
                SetTimer("CountdownGO",1000,false);
            }
        }
    }
    return 1;
}

public CountdownGO()
{
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
    {
        if(IsPlayerConnected(playerid))
        {
            if(Player[playerid] == 1)
            {
                GameTextForAll("~r~GO ~y~GO ~g~GO!!",1000,6);
                PlayerPlaySound(playerid, 1056, 0, 0, 0);
                Player[playerid] = 0;
            }
        }
    }
    return 1;
}
That may solve your issues.

Cheers,

TJ
Reply


Messages In This Thread
Timer doesn't work with my /countdown - by Reklez - 14.03.2012, 08:06
Re: Timer doesn't work with my /countdown - by TTJJ - 14.03.2012, 09:33

Forum Jump:


Users browsing this thread: 1 Guest(s)