SA-MP Forums Archive
countdown help [++REP] - 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: countdown help [++REP] (/showthread.php?tid=582318)



countdown help [++REP] - simo0000 - 19.07.2015

-Solved-


Re: countdown help [++REP] - simo0000 - 19.07.2015

bump


Re: countdown help [++REP] - simo0000 - 19.07.2015

bump!


Re: countdown help [++REP] - DarkLored - 19.07.2015

Search on ****** minutes to milliseconds converter and simply convert the number and apply it to your timer, please do not bump the topic every few minutes.


Re: countdown help [++REP] - Glenn332 - 19.07.2015

PHP код:
new SecondCount 0;
new 
MaxSeconds 600;
new 
CountTimer;
forward Counter();
public 
Counter()
{
    
SecondCount++;
    new 
string[256];
    new 
timeremaining MaxSeconds SecondCount;
    
//if(timeremaining == 0) {
    //Either add code here for when the timer runs out
    //}
    
for(new i=0;i<MAX_PLAYERS;i++) {
            if(
timeremaining == 0) {
            
format(stringsizeof(string), "The timer has run out");
            
SendClientMessage(i0xFF0000FFstring);
            
//KillTimer(CountTimer);//Example
            //SecondCount = 0;//Example
            // or here for when the timer runs out for every specific player
            
} else {
            
format(stringsizeof(string), "%d remaining!",timeremaining);
            
SendClientMessage(i0xFF0000FFstring);
            }
    }
    return 
1;
}
CountTimer SetTimerEx("Counter"1*1000true"d");// add where you want to start the timer.
KillTimer(CountTimer);// add where you wanna kill the timer
SecondCount 0;// add where you wanna reset seconds of counter 
If you need help converting seconds to minutes and hours and such tell me.


Re: countdown help [++REP] - Glenn332 - 19.07.2015

Just made this real quick incase you do need it, just replace second format with this:

PHP код:
new seconds SecondCountminutes;
while(
seconds 59)
{
    
seconds -= 60;
    
minutes++;
}
format(stringsizeof(string), "%02d:%02d remaining!",minutes,seconds); 



Re: countdown help [++REP] - simo0000 - 19.07.2015

Quote:
Originally Posted by Glenn332
Посмотреть сообщение
PHP код:
new SecondCount 0;
new 
MaxSeconds 600;
new 
CountTimer;
forward Counter();
public 
Counter()
{
    
SecondCount++;
    new 
string[256];
    new 
timeremaining MaxSeconds SecondCount;
    
//if(timeremaining == 0) {
    //Either add code here for when the timer runs out
    //}
    
for(new i=0;i<MAX_PLAYERS;i++) {
            if(
timeremaining == 0) {
            
format(stringsizeof(string), "The timer has run out");
            
SendClientMessage(i0xFF0000FFstring);
            
//KillTimer(CountTimer);//Example
            //SecondCount = 0;//Example
            // or here for when the timer runs out for every specific player
            
} else {
            
format(stringsizeof(string), "%d remaining!",timeremaining);
            
SendClientMessage(i0xFF0000FFstring);
            }
    }
    return 
1;
}
CountTimer SetTimerEx("Counter"1*1000true"d");// add where you want to start the timer.
KillTimer(CountTimer);// add where you wanna kill the timer
SecondCount 0;// add where you wanna reset seconds of counter 
If you need help converting seconds to minutes and hours and such tell me.
thnx +rep


Re: countdown help [++REP] - Glenn332 - 19.07.2015

Quote:
Originally Posted by simo0000
Посмотреть сообщение
thnx +rep
Thanks bud check this aswell,

Quote:

Just made this real quick incase you do need it, just replace second format with this:

PHP код:
new seconds SecondCountminutes;
while(
seconds 59)
{
    
seconds -= 60;
    
minutes++;
}
format(stringsizeof(string), "%02d:%02d remaining!",minutes,seconds); 



Re: countdown help [++REP] - simo0000 - 19.07.2015

Quote:
Originally Posted by Glenn332
Посмотреть сообщение
Thanks bud check this aswell,
yes it's working perfect thnx


Re: countdown help [++REP] - Glenn332 - 19.07.2015

Quote:
Originally Posted by simo0000
Посмотреть сообщение
yes it's working perfect thnx
No problem.