SA-MP Forums Archive
Time(hours,minutes,seconds) - 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(hours,minutes,seconds) (/showthread.php?tid=607613)



Time(hours,minutes,seconds) - Problems - 21.05.2016

I'm using some saved variables that save the player's hours,minutes and seconds while playing in server
and i made it in /stats so players can see their playing time.
but the playing time appears like numbers.
Example: 2:3:40 [2 Hours,3 Minutes and 40 Seconds]
I want it to appear like 02:03:40.

I use for example
Код:
format(string,sizeof(string),"Playing Time: %d:%d:%d",hours[playerid],mins[playerid],secs[playerid]);
SendClientMessage(playerid,-1,string);



Re: Time(hours,minutes,seconds) - AbyssMorgan - 21.05.2016

PHP код:
format(string,sizeof(string),"Playing Time: %02d:%02d:%02d",hours[playerid],mins[playerid],secs[playerid]); 



Re: Time(hours,minutes,seconds) - Problems - 21.05.2016

Thanks, and another question I save the date the player joined how to make it like the example i wrote up.
The Example:
Код:
format(string,sizeof(string),"Date Joined: %d"datejoined[playerid]);
SendClientMessage(playerid,-1,string);
like it should show any date like 21/05/2016.


Re: Time(hours,minutes,seconds) - ilijap - 21.05.2016

Quote:
Originally Posted by Problems
Посмотреть сообщение
Thanks, and another question I save the date the player joined how to make it like the example i wrote up.
The Example:
Код:
format(string,sizeof(string),"Date Joined: %d"datejoined[playerid]);
SendClientMessage(playerid,-1,string);
like it should show any date like 21/05/2016.
Save it with string or another integer for day/month/year . And will be like this:
PHP код:
format(string,sizeof(string),"Date Joined: %d/%d/%d",datejoinedday[playerid], datejoinedmonth[playerid], datejoinedyear[playerid]); 
Or like this:

PHP код:
format(string,sizeof(string),"Date Joined: %s",datejoined[playerid]);