Count down with textdraw
#1

I created a player textdraw that count down and i use this snipped by Hiddos
Код:
forward CountDown(seconds);
public CountDown(seconds)
{
  if(seconds == 0)
  {
    //All your code for when the timer reaches 0
    return; //THIS IS ESSENTIAL TO WORK!!!
  }
  SetTimerEx("CountDown", 1000, 0, "d", seconds-1);
  new minutes;
  while(seconds < 59)
  {
    seconds -= 60;
    minutes++;
  }
  new string[8];
  if(seconds < 10) format(string, sizeof string, "%d:0%d" minutes, seconds);
  else format(string, sizeof string, "%d:%d" minutes, seconds);
  TextDrawSetString(counting[i], string);
}
but i get this error
Код:
 
error 001: expected token: "-string end-", but found "-identifier-"
warning 215: expression has no effect
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#2

Код:
  if(seconds < 10) format(string, sizeof(string), "%d:%d", minutes, seconds);
  else format(string, sizeof(string), "%d:%d", minutes, seconds);
Reply
#3

Use %02d instead of the unnecessary if statements.

Quote:
Originally Posted by X337
Посмотреть сообщение
Код:
  if(seconds < 10) format(string, sizeof(string), "%d:%d", minutes, seconds);
  else format(string, sizeof(string), "%d:%d", minutes, seconds);
Your code does the same thing in both cases.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)