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



Time - Deny1 - 31.01.2016

Код:
public settime(playerid)
{
        new string[256],year,month,day,hours,minutes;
        getdate(year, month, day), gettime(hours, minutes);
        format(string, sizeof string, "%s%d.%s%d.%d", (year < 10) ? ("0") : (""), year, ((month < 10) ? ("0") : ("")), month, day);
        TextDrawSetString(DateB, string);
        format(string, sizeof string, "%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes);
        TextDrawSetString(TimeB, string);
}
this is my time... how can i make if is example moring to be moring and if is 20:00h to be night


Re: Time - Darkwood17 - 31.01.2016

You mean if the time is 8:00, the in-game time to be 8:00 (morning time)?


Re: Time - Deny1 - 31.01.2016

yes..


Re: Time - Darkwood17 - 31.01.2016

Код:
public settime(playerid)
{
        new string[256],year,month,day,hours,minutes;
        getdate(year, month, day), gettime(hours, minutes);
        format(string, sizeof string, "%s%d.%s%d.%d", (year < 10) ? ("0") : (""), year, ((month < 10) ? ("0") : ("")), month, day);
        TextDrawSetString(DatumB, string);
        format(string, sizeof string, "%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes);
        TextDrawSetString(TimeB, string);
        SetWorldTime(hours);
}
Just add SetWorldTime(hours);


Re: Time - AbyssMorgan - 31.01.2016

wtf, why these conditions

PHP код:
public settime(playerid){
    new 
string[256],year,month,day,hours,minutes;
    
getdate(yearmonthday), gettime(hoursminutes);
    
format(stringsizeof string"%02d.%02d.%02d"yearmonthday);
    
TextDrawSetString(DatumBstring);
    
format(stringsizeof string"%02d:%02d",  hours,  minutes);
    
TextDrawSetString(VrijemeBstring);