27.07.2012, 21:42
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.
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;
}
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);
}
}