Countdown Time Thing
#1

Can anyone show me how to put together a countdown thing

Starts from 12:00 then counts down like 11:59, 11:58 etc etc.

Like in a gametext thanks!
Reply
#2

Ask in the script request topic.
Reply
#3

Im asking them to show me.
Reply
#4

Just edit GameTextForAll("Lol",1000,6); in the forward function

pawn Код:
//Top of script
new CountDown = -1;

//The function (Put in a command or whatever)
if(CountDown == -1)
{
  CountDown = 1200;
  SetTimer("Countdown",500,0);
}

//Bottom of script
forward countdown();
public countdown()
{
    if(CountDown==1200) GameTextForAll("Countdown Starting...",1000,6);

    CountDown--;
    if(CountDown==0)
    {
        GameTextForAll("Lol",1000,6);//Edit Lol to what will be shown when the countdown reaches 0
        CountDown = -1;
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            TogglePlayerControllable(i,true);
            PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
        }
        return 0;
    }
    else
    {
        new text[7]; format(text,sizeof(text),"~w~%d",CountDown);
        for(new i = 0; i < MAX_PLAYERS; i++) {
            PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
            TogglePlayerControllable(i,false);
        }
        GameTextForAll(text,1000,6);
    }
   
    SetTimer("countdown",1000,0);
    return 0;
}
Reply
#5

I put together my own clock thing now. But when it does like

10:5

How do i do it so it does like

10:05
Reply
#6

Example:
pawn Код:
public Function()
{
  new
    string[6], // remember that 00:00 has 5 characters + 1 == 6
    value = 1,
    number = 2;

  format(string, sizeof(string), "%d:%d", value, number); // this will print 1:2
  print(string);
  format(string, sizeof(string), "%02d:%02d", value, number); // this will print 01:02
  print(string);
  return 1;
}
Reply
#7

http://forum.sa-mp.com/index.php?top...9980#msg909980
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)