[HELP]Textdraw Timer
#1

Hy guys,i creating textdraw timer, and when i start that timer he countdown every 1 sec -2 sec on textdraw, and when i killtimer that timer he dont shut down..

new:
Код:
new Timed, TimeM, TimeS;
callback:
Код:
forward UpdateTime();
public UpdateTime()
{
  new Str[34];
  TimeS --;
  if(TimeM == 0 && TimeS == 0)
  {
    KillTimer(Timed);
  }
  if(TimeS == -1)
  {
    TimeM--;
    TimeS = 59;
  }
  format(Str, sizeof(Str), "%02d:%02d", TimeM, TimeS);
  TextDrawSetString(Derbydole2, Str);
  return 1;
}
textdraw
Код:
Derbydole2 = TextDrawCreate(180.000000, 435.750000, "05:00");
TextDrawLetterSize(Derbydole2, 0.358000, 1.075000);
TextDrawAlignment(Derbydole2, 1);
TextDrawColor(Derbydole2, -1);
TextDrawSetShadow(Derbydole2, 0);
TextDrawSetOutline(Derbydole2, 1);
TextDrawBackgroundColor(Derbydole2, 51);
TextDrawFont(Derbydole2, 2);
TextDrawSetProportional(Derbydole2, 1);
timer:

Код:
Timed = SetTimer("UpdateTime", 1000, true);
Reply
#2

when you make the variable, it stores the value 0 on them, so the

pawn Код:
if(TimeM == 0 && TimeS == 0)
  {
    KillTimer(Timed);
  }
would never happen, do you initialize the variables to another value?
Reply
#3

Quote:
Originally Posted by Xabi
Посмотреть сообщение
when you make the variable, it stores the value 0 on them, so the

pawn Код:
if(TimeM == 0 && TimeS == 0)
  {
    KillTimer(Timed);
  }
would never happen, do you initialize the variables to another value?
ok i delete that cuz i dont need that but again count for 1 second -2 on td...
Reply
#4

SRY FOR DOBULE POST!!!!!!!!!

i was searching samp forum and i find this:

Quote:
Originally Posted by Vince
Посмотреть сообщение
Gotta love how everyone always seems to do that.
You can get rid of that if structure completely by using the right format values.

pawn Код:
format(Str, sizeof(Str) "%02d:%02d", TimeM, TimeS);
Will always output two digits, no matter the values.
now what is right format value for this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)