Display countdown
#1

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 ; )
Reply
#2

Okay here's a simple example so that only one timer is active at a time for the countdown.

pawn Код:
new Count = 5;
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.
Reply
#3

I see, but where did you insert the In..."" string?
Reply
#4

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
Reply
#5

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?
Reply
#6

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.
Reply
#7

yes, but I don't know what count variable is :S
Reply
#8

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!
Reply
#9

Oh, I see thank you!
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)