Time problem!
#3

Gettime - Get the current server time, which will be stored in the variables &hour, &minute and &second.
pawn Код:
public settime(playerid)
{
    new string[256],year,month,day,hours,minutes,seconds;
    getdate(year, month, day), gettime(hours, minutes, seconds);
    format(string, sizeof string, "%d/%02d%02d", day, month, year);
    TextDrawSetString(Date, string);
    format(string, sizeof string, "%02d:%02d:%02d", hours-2, minutes, seconds);
    TextDrawSetString(Time, string);
}
Guess what? There is a format of %02d and if it's under 10, let's say 9, it uses 09. It's not need to use if/else for 0 or null.
Reply


Messages In This Thread
Time problem! - by Baumann - 01.12.2012, 12:05
AW: Time problem! - by Skimmer - 01.12.2012, 12:42
Re: Time problem! - by Konstantinos - 01.12.2012, 12:52
Re: Time problem! - by Baumann - 01.12.2012, 14:09
Re: Time problem! - by Baumann - 01.12.2012, 14:28
Re: Time problem! - by InfiniTy. - 01.12.2012, 14:34
Re: Time problem! - by Konstantinos - 01.12.2012, 14:36
Re: Time problem! - by Baumann - 01.12.2012, 19:24
Re: Time problem! - by dr.lozer - 01.12.2012, 19:28

Forum Jump:


Users browsing this thread: 3 Guest(s)