SA-MP Forums Archive
World 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)
+--- Thread: World time! (/showthread.php?tid=578556)



World time! - Sn4ke2 - 20.06.2015

How to set world time ? I'm from Romanian and i want Romanian Hour.


Re: World time! - Abagail - 20.06.2015

If you mean how to sync it with your local time you need to get your time in-game. An example of this is using a PHP script which returns the time of a current timezone and sending it with the server syncs the time.

Example:
pawn Код:
stock syncServerTime(timezone)
{
    new string[64];
    format(string, sizeof(string), "website.com/timezone.php?t=%d", timezone);
    HTTP(0, HTTP_GET, string, "", "OnServerTimeSync");
    return 1;
}

forward OnServerTimeSync(index, response_code, data[]);
public OnServerTimeSync(index, response_code, data[])
{
    if(response_code == 200)
    {
        new timezone = strval(data);
        SetWorldTime(timezone);
    }
   
    return 1;
}
Basically, this is how something like this can be done. This would depend on a PHP script that returns the hour of your local time.


Re: World time! - SoFahim - 20.06.2015

Can you please what type your gamemode? and you are using PHP or something?