[SIMPLE] Creating a 1 minute countdown [SIMPLE]
#1

I need to know of an easy was on how to create a countdown that shows on the screen from 1:00 all the way to 0.
Reply
#2

K so.. How you want it to be? GameText, or SendClientMessage?
Reply
#3

Alright... I haven't tested this, but it compiled fine.. So..
pawn Code:
new time = 60;
new timer1;

forward timer();
public timer()
{
    new string[128];
    if(time > 0)
    {
        time--;
        format(string, sizeof(string), "%d", time - 1);
    }
    else
    {
        time = 60;
        format(string, sizeof(string), "Go!");
        KillTimer(timer1);
    }
    GameTextForAll(string, 1000, 4);
    return 1;
}


CMD:countdown(playerid)
{
    timer1 = SetTimer("timer", 1000/* 1 second */, true);
    return 1;
}
Reply
#4

It should be like This.
pawn Code:
forward countdown(number)
public countdown(number)
{
    new l_2[4];
    if(number > 0) {
        format(l_2),sizeof(l_2),"%d",number - 1);
        GameTextForAll(l_2, 1000, 4);
        SetTimer("timer", 1000, false);
    }
    else {
        GameTextForAll("Go", 1000, 4);
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)