Countdown
#1

Hi i was woundering how to make a countdown timer so it gose

5

4

3

2

1
but it shows 1 number at a time so if someone could help that wold be nice
Reply
#2

somethign like this
pawn Код:
//top of script
new count = 5;
new counttimer;
forward CountDown();

//after main()
public CountDown()
{
  if(count <= 0)
  {
   GameTextForAll("~g~ Go ~n~ Go ~n~ Go!", 5000, 5);
   KillTimer(counttimer);
   count = 5;
   return 1;
  }
  else
  {
   new str[128];
   format(str, sizeof str, "~b~ %d", count);
   GameTextForAll(str, 500, 5);
   counttimer = SetTimer("CountDown", 1000, 0);
  }
  return 1;
}

//command
if(strcmp(cmdtext, "/countdown", true) == 0)
{
  CountDown();
}
Reply
#3

it just repeats 5 5 5 5 5 5 5 5 5 5 5
Reply
#4

my bad After this line
pawn Код:
counttimer = SetTimer("CountDown", 1000, 0);
put:
pawn Код:
count--;
Reply
#5

it worked thx
Reply
#6

Eh, no problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)