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



Sync Time - ihatetn931 - 24.09.2010

How can i sync the clock that shows when you TogglePlayerClock(1); With the Computer time, Like it shows the hour and the Min.

So for example It's 4:24 my time, The clock in game will show 4:24. Basically it sets that clock to the computers clock the server is hosted on, I've tried GetTime and all that but it only seems to sync the Mins. and the seconds. I've searched the forums but i couldn't find anything usefull, I'm sure it's very simple I just can't figure it out


Re: Sync Time - LarzI - 24.09.2010

Use GetTime, then if minutes = 60, set it to 0 and add 1 value to hours.. ?


Re: Sync Time - ihatetn931 - 24.09.2010

GetTime, Sets the TogglePlayerClock clock?... As of now i have a /time command which is sync with my computer time. It's Copied from the orginal Pen:Ls Scirpt.

pawn Код:
forward SyncTime();
public SyncTime()
{
    if (gdebug >= 3){printf("DEBUG SyncTime()"); }
    for(new i = 0; i <= MAX_PLAYERS; i++)
    {
    new string[64];
    new tmphour;
    new tmpminute;
    new tmpsecond;
    gettime(tmphour, tmpminute, tmpsecond);
    FixHour(tmphour);
    tmphour = shifthour;
    if ((tmphour > ghour) || (tmphour == 0 && ghour == 23)) {
        PayDay();
        format(string, sizeof(string), "SERVER: The Time Is Now %d:00 Hours",tmphour);
        BroadCast(COLOR_WHITE,string);
        if (gdebug){printf("DEBUG tmphour=%d ghour=%d",tmphour,ghour);}
        ghour = tmphour;
        if (realtime) {
            SetWorldTime(tmphour);
            //SetPlayerTime(i,tmphour,tmpminute);
        }
    }
}
}
When when i TogglePlayerClock it just counts by seconds and mins. As you can tell i have tried to set it with SetplayerTime Also.


Re: Sync Time - Voldemort - 24.09.2010

Quote:
Originally Posted by ihatetn931
Посмотреть сообщение
How can i sync the clock that shows when you TogglePlayerClock(1); With the Computer time, Like it shows the hour and the Min.

So for example It's 4:24 my time, The clock in game will show 4:24. Basically it sets that clock to the computers clock the server is hosted on, I've tried GetTime and all that but it only seems to sync the Mins. and the seconds. I've searched the forums but i couldn't find anything usefull, I'm sure it's very simple I just can't figure it out


TogglePlayerClock(1); is for thing what he do, you can't sync it with real time, you must use GetTime, use glTime or something like that Filterscript there is TextDraw wich looks like SP clock but, but uses real time


Re: Sync Time - LarzI - 24.09.2010

As I posted in the topic above this one:
Why not use the realtime fs which is included in the server package? I believe that's working fully.


Re: Sync Time - ihatetn931 - 24.09.2010

Oh so i can only do it with a textdraw, Ahh darn I was hoping i could make my weather change smoother with TogglePlayerClock and it showing the real time. I guess i have to deal with the weather changing instantly