SA-MP Forums Archive
Timer Help again - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Timer Help again (/showthread.php?tid=123318)



Timer Help again - deather - 25.01.2010

How to reset a timer.?
I mean, i have completed a countdown, and killed the timer. when i start the countdown again it runs in negative values!!


Re: Timer Help again - Deat_Itself - 25.01.2010

show us your code


Re: Timer Help again - deather - 25.01.2010

Код:
new Countdown = 20;
new CountDownTimer;
forward Countdowntimer(playerid);

CountDownTimer= SetTimer("Countdowntimer", 999, true);

public Countdowntimer(playerid)
{
	Countdown--;
	new string[128];
  format(string, sizeof(string), "%d", Countdown);
  TextDrawSetString(cd, string);
  TextDrawShowForAll(cd);
  
  if(Countdown == 0)
  {
  new rand = random(sizeof(gRandomPlayerSpawns));
  ResetPlayerWeapons(playerid);
  KillTimer(CountDownTimer);
  TextDrawHideForAll(cd);
  TextDrawHideForAll(Textdraw4);
  Countdown = 20; // This is line where i reset the time seconds to 20 again. But it doesnt work
  }
}



Re: Timer Help again - Deat_Itself - 25.01.2010

new string[2]; instead of string[128];


Re: Timer Help again - deather - 25.01.2010

Quote:
Originally Posted by _Saif_
new string[2]; instead of string[128];
It didnt work.
When i enter the checkpoint the time from 20 changed to 1 immediately


Re: Timer Help again - Deat_Itself - 25.01.2010

then you done something wrong in your command in which the command starts


Re: Timer Help again - deather - 25.01.2010

but when i changed it to 3 and more it worked