Display 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: Display countdown (
/showthread.php?tid=196422)
Display countdown -
knackworst - 05.12.2010
hi, can anyone explain me what functions to use to make a countdown display?
and also to make a countdown not on this way:
pawn Код:
settimer(example,"other stuff", 1,other stuff)
OnPublicExample
{
Settimer....
so not that you have to make 20timers to make a countdown...
please help me ; )
Re: Display countdown -
JaTochNietDan - 05.12.2010
Okay here's a simple example so that only one timer is active at a time for the countdown.
pawn Код:
if(strcmp(cmdtext,"/count",true) == 0)
{
if(Count < 5) return SendClientMessage(playerid,red,"Countdown is already in progress");
SetTimer("CountDown",1000,0);
return 1;
}
pawn Код:
public CountDown()
{
format(string,sizeof(string),"In...%d",Count);
if(Count == 0)
{
GameTextForAll("Go go go!",1500,3);
Count = 5;
}
else
{
GameTextForAll(string,1500,3);
Count--;
SetTimer("CountDown",1000,0);
}
return 1;
}
That's just a simple example, you could also use a repeating timer with the KillTimer function.
Re: Display countdown -
knackworst - 05.12.2010
I see, but where did you insert the In..."" string?
Re: Display countdown -
JaTochNietDan - 05.12.2010
What do you mean? The variable "string"? Well I was assuming you will have your own string variables to worry about, it's only an example, not copy-paste snippet
Re: Display countdown -
knackworst - 05.12.2010
meh, but I need a displayed thing wich says: 5 minuts until minigame starts
and one minut after that it says 4mins etc...
Is the best way to do this is using extimer and just make textdraw for every minut?
Re: Display countdown -
JaTochNietDan - 05.12.2010
Well in my opinion, for example, all you would need is one textdraw and then set a timer to repeat every 60 seconds and decrease the count variable by 1. Then just edit the textdraw and it will update on people's screens showing 4 minutes...3 and so on as the timer repeats.
Re: Display countdown -
knackworst - 05.12.2010
yes, but I don't know what count variable is :S
Re: Display countdown -
JaTochNietDan - 05.12.2010
Look at my example, that's what I was referring to. Just a simple variable that is decremented every 60 seconds, that is your minutes value for the textdraw!
Re: Display countdown -
knackworst - 05.12.2010
Oh, I see thank you!