Countdown
#1

This dont work.. IDK why..

The count down dont appear

pawn Код:
forward CountDown(playerid, time);
public CountDown(playerid, time)
{
    if((--time) < 1)
    {
        //tadaaaa The count down is done :D
        return ;
    }
    else
    {
        new string[128];
        format(string, sizeof string, "%d", time);
        SendClientMessage(-(playerid + 1), 0xFFFFFFAA, string);
        SetTimerEx("Countdown", 1000, false, "ii", playerid, time);
    }
}
Reply
#2

Not sure, maybe
pawn Код:
SendClientMessage(playerid, 0xFFFFFFAA, string);
Reply
#3

pawn Код:
forward CountDown(playerid, time);
public CountDown(playerid, time)
{
    if(time < 1)
    {
        //tadaaaa The count down is done :D
    }
    else
    {
        new string[8];
        format(string, sizeof string, "%d", time);
        SendClientMessage(playerid, 0xFFFFFFAA, string);
        SetTimerEx("Countdown", 1000, false, "ii", playerid, time-1);
    }
    return 1;
}
Reply
#4

Thnx
Reply
#5

Bot how to Kill the counter? when the persion die?

/scd - Start count down
120
119
128
ect.
(The player dies) [The count down is supposed to stop now]
127
126
ect...
Reply
#6

At the top of the script put...

pawn Код:
new Count[MAX_PLAYERS]; // Cannot be same name of the function itself
Then change what you had to this

pawn Код:
forward CountDown(playerid, time);
public CountDown(playerid, time)
{
    if(time < 1)
    {
        //tadaaaa The count down is done :D
    }
    else
    {
        new string[8];
        format(string, sizeof string, "%d", time);
        SendClientMessage(playerid, 0xFFFFFFAA, string);
        Count[playerid] = SetTimerEx("Countdown", 1000, false, "ii", playerid, time-1);
    }
    return 1;
}
And now, whenever you want the countdown to STOP, you use this code.

pawn Код:
KillTimer(Count[playerid]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)