Time FIX of my server.

Guel

Member
Joined
Aug 8, 2020
Messages
20
Reaction score
1
Location
Philippines
Hello, I got a problem on my server which the time in game doesn't sync in our region. How can I fix it?


I'm from Philippines btw.
C-like:
GetDate()
{
    new date[5], string[24];

    getdate(date[0], date[1], date[2]);
    gettime(date[3], date[4]);

    format(string, sizeof(string), "%i-%02d-%02d %02d:%02d", date[0], date[1], date[2], date[3], date[4]);
    return string;
}


RefreshTime()
{
    new hour, minute, string[12];

    gettime(hour, minute);

    format(string, sizeof(string), "%02d:%02d", hour, minute);
    TextDrawSetString(TimeTD, string);

    format(string, sizeof(string), "%02d:%02d", hour, minute);
    TextDrawSetString(PhoneTD[11], string);

    format(string, sizeof(string), "%02d:%02d", hour, minute);
    TextDrawSetString(CallingTD[11], string);
}

CMD:pw(playerid, params[])
{
    if(!pData[playerid][pWatch])
    {
        return SCM(playerid, COLOR_SYNTAX, "You don't have a pocket watch. You can buy one at 24/7.");
    }

    if(!pData[playerid][pWatchOn])
    {
        if(pData[playerid][pToggleTextdraws])
        {
            return SCM(playerid, COLOR_SYNTAX, "You can't turn on your watch as you have textdraws toggled! (/toggle textdraws)");
        }

        pData[playerid][pWatchOn] = 1;
        ApplyAnimation(playerid, "COP_AMBIENT", "Coplook_watch", 4.1, 0, 0, 0, 0, 0);
        TextDrawShowForPlayer(playerid, TimeTD);
        SendProximityMessage(playerid, 20.0, SERVER_COLOR, "**{C2A2DA} %s turns on their watch.", GetRPName(playerid));
    }
    else
    {
        pData[playerid][pWatchOn] = 0;
        ApplyAnimation(playerid, "COP_AMBIENT", "Coplook_watch", 4.1, 0, 0, 0, 0, 0);
        TextDrawHideForPlayer(playerid, TimeTD);
        SendProximityMessage(playerid, 20.0, SERVER_COLOR, "**{C2A2DA} %s turns off their watch.", GetRPName(playerid));
    }

    return 1;
}
 
Last edited:

Fr0z3n

Well-known member
Joined
Nov 20, 2019
Messages
294
Reaction score
36
Location
Srbija
Just add time that u need if is 7:00 PM and from your location is 8:00PM add +1 hour or add 1+minutes u get it...
 

Guel

Member
Joined
Aug 8, 2020
Messages
20
Reaction score
1
Location
Philippines
Just add time that u need if is 7:00 PM and from your location is 8:00PM add +1 hour or add 1+minutes u get it...
where should I add? I tried on the output of refresh time function but it doesnt reset on 24 it keeps adding. It should be 00:00 right?
 

Fr0z3n

Well-known member
Joined
Nov 20, 2019
Messages
294
Reaction score
36
Location
Srbija
set something like if time is > 24 THEN do -24 which is ecual to 00:00 right?
 

Guel

Member
Joined
Aug 8, 2020
Messages
20
Reaction score
1
Location
Philippines
can you make a pseudocode for that what u mean, using my code as a reference?
where I should add and where should I put that if statement? btw I can't add a number in the line of gettime(hours, minutes);
 
Top