Time countdown - 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)
+--- Thread: Time countdown (
/showthread.php?tid=591289)
Time countdown -
Fantje - 10.10.2015
Heey guys,
I need some help with a countdown. So it countdown from 05:00 to 00:00 ( minutes ).
Example:
Peace
Re: Time countdown -
AbyssMorgan - 10.10.2015
https://sampforum.blast.hk/showthread.php?tid=591209
I have already written how to do
Re: Time countdown -
Fantje - 10.10.2015
Quote:
Originally Posted by AbyssMorgan
|
It don't really work. It starts from -1:40 and when that times up, it starts from -3:00. really wierd xd
Re: Time countdown -
AbyssMorgan - 10.10.2015
because I said that the start value is 0 and no 300
Re: Time countdown -
Fantje - 10.10.2015
Quote:
Originally Posted by AbyssMorgan
because I said that the start value is 0 and no 300
|
So how to fix?
Re: Time countdown -
AbyssMorgan - 10.10.2015
START: timecnt = 0, timestop = 300
every second:
PHP код:
timecnt++; // 1 2 3 4 ... 300
new timessek, timesmin;
timesmin = ((timestop-timecnt)/60);
timessek = (timestop-(timecnt+(timesmin*60)));
format(buffer,sizeof buffer,"%02d:%02d",timesmin,timessek);
//show time
if(timecnt == timestop){
//The End
timecnt = 0; //reset
}
//edit: despite counting upwards, it shows the time down: 5:00 4:59 ... 0:00
Example:
https://www.youtube.com/watch?v=desa4vyIHGs
countup, time down
Re: Time countdown -
Fantje - 10.10.2015
Quote:
Originally Posted by AbyssMorgan
START: timecnt = 0, timestop = 300
every second:
PHP код:
timecnt++; // 1 2 3 4 ... 300
new timessek, timesmin;
timesmin = ((timestop-timecnt)/60);
timessek = (timestop-(timecnt+(timesmin*60)));
format(buffer,sizeof buffer,"%02d:%02d",timesmin,timessek);
//show time
if(timecnt == timestop){
//The End
timecnt = 0; //reset
}
//edit: despite counting upwards, it shows the time down: 5:00 4:59 ... 0:00
Example:
https://www.youtube.com/watch?v=desa4vyIHGs
countup, time down
|
Okay it works but the only problem is that I can't kill the timer. But I have to kill it so how?
Re: Time countdown -
AbyssMorgan - 10.10.2015
Example:
PHP код:
new mytimer;
//Start
mytimer = SetTimer("CountDownTimer", 1000, 1);
//Stop
KillTimer(mytimer);
Re: Time countdown -
Fantje - 10.10.2015
Quote:
Originally Posted by AbyssMorgan
Example:
PHP код:
new mytimer;
//Start
mytimer = SetTimer("CountDownTimer", 1000, 1);
//Stop
KillTimer(mytimer);
|
Okay that works. Now: The timer works and stops at 00:00 and then the server restarts (SendRconCommand(changemode) and when the new mission starts the timer won't show up. When I type rcon reloadfs ASystemv1 it shows up. ( Yes my timer is in a admin system ).
Re: Time countdown -
Fantje - 10.10.2015
Anyone fix for ast problem?