28.12.2013, 21:56
So gettime function returns hrs/mins/secs as '0', not 00.
It's easy to format string many times and check if hrs > 0 & < 9 (same with mins)
but how to make with ternary operator, if hrs/mins < 10 it would be ex.
04:32
07:01
and not
4:32
7:1
My /time command, please help REP+
It's easy to format string many times and check if hrs > 0 & < 9 (same with mins)
but how to make with ternary operator, if hrs/mins < 10 it would be ex.
04:32
07:01
and not
4:32
7:1
My /time command, please help REP+
pawn Code:
YCMD:time(playerid, params[], help)
{
#pragma unused help
#pragma unused params
new hrs,mins,sec,day,month,year;
gettime(hrs, mins, sec);
getdate(year, moth, day);
new string[45];
format(string, sizeof(string), "Today is: %d. %d. %d | Current Time: %d:%d", day, month, year, hrs, mins);
return SendClientMessage(playerid, -1, string);
}