[SIMPLE] Creating a 1 minute countdown [SIMPLE] - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [SIMPLE] Creating a 1 minute countdown [SIMPLE] (
/showthread.php?tid=363519)
[SIMPLE] Creating a 1 minute countdown [SIMPLE] -
ShawtyyMacJunior - 27.07.2012
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.
Re: [SIMPLE] Creating a 1 minute countdown [SIMPLE] -
Dubya - 27.07.2012
K so.. How you want it to be? GameText, or SendClientMessage?
Re: [SIMPLE] Creating a 1 minute countdown [SIMPLE] -
Dubya - 27.07.2012
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;
}
Re: [SIMPLE] Creating a 1 minute countdown [SIMPLE] -
leonardo1434 - 27.07.2012
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);
}
}