SA-MP Forums Archive
Function - 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: Function (/showthread.php?tid=577684)



Function - STONEGOLD - 13.06.2015

I need a function for online time.

60 seconds = 1min
60mins = 1 hour

same as real. anyone help me?


Re: Function - SoFahim - 13.06.2015

PHP код:
forward SyncTime();
public 
SyncTime()
{
    new 
string[64];
    new 
tmphour;
    new 
tmpminute;
    new 
tmpsecond;
    
gettime(tmphourtmpminutetmpsecond);
    
FixHour(tmphour);
    
tmphour shifthour;
    if ((
tmphour ghour) || (tmphour == && ghour == 23))


in OngamemodeInit

use this line


PHP код:
    if(!realtime)
    {
        
SetWorldTime(wtime);
        
gTime wtime;
    }

    if (
realtime)
    {
        new 
tmphour;
        new 
tmpminute;
        new 
tmpsecond;
        
gettime(tmphourtmpminutetmpsecond);
        
FixHour(tmphour);
        
tmphour shifthour;
        
SetWorldTime(tmphour);
        
gTime tmphour;
    }

    if(!
realtime)
    {
        
SetWorldTime(wtime);
        
gTime wtime;
    } 
in
task SyncUp
put this line

PHP код:
SyncTime(); 
This is only for RP server


Re: Function - JaydenJason - 13.06.2015

Quote:
Originally Posted by SoFahim
Посмотреть сообщение
PHP код:
forward SyncTime();
public 
SyncTime()
{
    new 
string[64];
    new 
tmphour;
    new 
tmpminute;
    new 
tmpsecond;
    
gettime(tmphourtmpminutetmpsecond);
    
FixHour(tmphour);
    
tmphour shifthour;
    if ((
tmphour ghour) || (tmphour == && ghour == 23))

in OngamemodeInit

use this line


PHP код:
    if(!realtime)
    {
        
SetWorldTime(wtime);
        
gTime wtime;
    }
    if (
realtime)
    {
        new 
tmphour;
        new 
tmpminute;
        new 
tmpsecond;
        
gettime(tmphourtmpminutetmpsecond);
        
FixHour(tmphour);
        
tmphour shifthour;
        
SetWorldTime(tmphour);
        
gTime tmphour;
    }
    if(!
realtime)
    {
        
SetWorldTime(wtime);
        
gTime wtime;
    } 
in
task SyncUp
put this line

PHP код:
SyncTime(); 
This is only for RP server
where's fixhour(blabla)