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



Time different - Shinta307 - 11.08.2014

CMD:TIME and Worldtime very different , when changing through CMD: TOD, CMD:Time has not changed at all.. How to order can be changed through time via CMD:TOD

This script
CMD:TOD
pawn Код:
CMD:tod(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 1337)
    {
        new string[128], time;
        if(sscanf(params, "d", time)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /tod [time] (0-23)");

        SetWorldTime(time);
        SetPlayerTime(playerid, 0, 0);
        gTime = time;
        format(string, sizeof(string), "Time set to %d:00.", time);
        BroadCast(COLOR_GRAD1, string);
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
    }
    return 1;
}
CMD:time
pawn Код:
CMD:time(playerid, params[])
{
    new string[128];
    new mtext[20];
    new year, month,day;
    getdate(year, month, day);
    if(month == 1) { mtext = "January"; }
    else if(month == 2) { mtext = "February"; }
    else if(month == 3) { mtext = "March"; }
    else if(month == 4) { mtext = "April"; }
    else if(month == 5) { mtext = "May"; }
    else if(month == 6) { mtext = "June"; }
    else if(month == 7) { mtext = "July"; }
    else if(month == 8) { mtext = "August"; }
    else if(month == 9) { mtext = "September"; }
    else if(month == 10) { mtext = "October"; }
    else if(month == 11) { mtext = "November"; }
    else if(month == 12) { mtext = "December"; }
    new hour,minuite,second;
    gettime(hour,minuite,second);
    FixHour(hour);
    hour = shifthour;
    if (minuite < 10)
    {
        if (PlayerInfo[playerid][pJailTime] > 0)
        {
            format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:0%d~g~|~n~~w~Jail Time Left: %d sec", day, mtext, hour, minuite, PlayerInfo[playerid][pJailTime]-10);
        }
        else
        {
            format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:0%d~g~|", day, mtext, hour, minuite);
        }
    }
    else
    {
        if (PlayerInfo[playerid][pJailTime] > 0)
        {
            format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:%d~g~|~n~~w~Jail Time Left: %d sec", day, mtext, hour, minuite, PlayerInfo[playerid][pJailTime]-10);
        }
        else
        {
            format(string, sizeof(string), "~y~%d %s~n~~g~|~w~%d:%d~g~|", day, mtext, hour, minuite);
        }
    }
    GameTextForPlayer(playerid, string, 5000, 1);
    return 1;
}
Sorry for mybad english


Re: Time different - Shinta307 - 11.08.2014

Please help..!


Re: Time different - GC - 11.08.2014

So your problem is that when you change the server time through /tod command, when you type /time command it does not show the new changed time?


Re: Time different - Shinta307 - 11.08.2014

Yes, in order to change how the command / time is.
My question is, simply, how do I change command /time


Re: Time different - SKAzini - 11.08.2014

Your /time gets the time from the realworld, not from the SA-MP server.

If you want /time to show worldtime, you could modify your script to use a variable which updates every minute.