countdown error
#7

We dont need to store the timer if its not repeating
There are two ways to write countdowns,
first with an repeating timer and an player array
or just with delayed recursion, like that
pawn Код:
forward CountingDown(playerid, time);
public CountingDown(playerid, time) {
    if(0 < time) {
        new number[8];
        valstr(number, time--, false);
        GameTextForPlayer(playerid, number, 1200, 4);
        SetTimerEx("CountingDown", 1000, false, "ii", playerid, time);
    } else {
        GameTextForPlayer(playerid, "~g~Go!", 2500, 3);
        TogglePlayerControllable(playerid, true);
        SendClientMessage(playerid, -1, "Go!");
    }
}
pawn Код:
if(strcmp(cmdtext, "/countdown", true) == 0) {
    CountingDown(playerid, 3);
}
Reply


Messages In This Thread
countdown error - by livests - 02.03.2012, 15:13
AW: countdown error - by Drebin - 02.03.2012, 15:15
Re: countdown error - by Gooday - 02.03.2012, 15:18
Re: countdown error - by livests - 02.03.2012, 15:20
Re: countdown error - by Konstantinos - 02.03.2012, 15:21
Re: countdown error - by livests - 02.03.2012, 15:29
AW: countdown error - by Nero_3D - 02.03.2012, 17:10

Forum Jump:


Users browsing this thread: 1 Guest(s)