Countdown - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Countdown (
/showthread.php?tid=221781)
Countdown - Unknown123 - 06.02.2011
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);
}
}
Re: Countdown -
On_Top_Non_Stop - 06.02.2011
Not sure, maybe
pawn Код:
SendClientMessage(playerid, 0xFFFFFFAA, string);
Re: Countdown -
Antonio [G-RP] - 06.02.2011
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;
}
Re: Countdown - Unknown123 - 06.02.2011
Thnx
Re: Countdown - Unknown123 - 06.02.2011
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...
Re: Countdown -
Antonio [G-RP] - 06.02.2011
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]);