24.04.2011, 05:41
Hi all, i was jsut wonderin.. how do u convert 24 hour time to 12 hour time? THX!
stock UpdateTimeForPlayer(playerid)
{
gettime(hour, minute);
SetWorldTime(hour);
SetPlayerTime(playerid, hour, minute);
format(timestr,sizeof(timestr),"%d:%d",hour,minute);
TextDrawSetString(txtTimeDisp,timestr);
}
wait a sec... ok.. i got this:
pawn Код:
|
stock UpdateTimeForPlayer(playerid)
{
gettime(hour, minute);
if(hour > 12) hour = hour - 12;//added by Nexotronix lol
SetWorldTime(hour);
SetPlayerTime(playerid, hour, minute);
format(timestr,sizeof(timestr),"%d:%d",hour,minute);
TextDrawSetString(txtTimeDisp,timestr);
}
if(hour > 12) hour = hour - 12;
stock UpdateTimeForPlayer(playerid)
{
gettime(hour, minute, second);
SetWorldTime(hour);
SetPlayerTime(playerid, hour, minute);
format(timestr,sizeof(timestr),"%d:%d:%d",hour,minute, second);
TextDrawSetString(txtTimeDisp,timestr);
}
but it already is 12 hour... idk y tho.. look at my updated code.. u can see it in this server if u want: 24.111.46.103:7777 i am fundude and im there rit now. But, heres the code:
pawn Код:
|