SA-MP Forums Archive
Stats help! - 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: Stats help! (/showthread.php?tid=473904)



Stats help! - Ninad - 05.11.2013

How can i add Hours, Minutes, Seconds in /stats command? +rep for help




Thank you!


Re: Stats help! - gotwarzone - 05.11.2013

Quote:
Originally Posted by Ninad
Посмотреть сообщение
How can i add Hours, Minutes, Seconds in /stats command? +rep for help




Thank you!
Credits to my friend Konstantinos


Put the code below somewhere in your /stats and change sz_str to which you are using currently using

Код HTML:
format(sz_str, sizeof(sz_str), "%s\nTime Login: %s", sz_str, ConvertTime2(seconds));
Код HTML:
stock ConvertTime2(cts)
{
    #define PLUR(%0,%1,%2) (%0),((%0) == 1)?((#%1)):((#%2))
    new strii[128], cth, ctm;
	cth = cts / 3600;
	cts %= 3600;
	ctm = cts / 60;
	cts %= 60;
	format(strii, sizeof(strii), "%d %s, %d %s", cth, (cth == 1) ? ("hour") : ("hours"), ctm, (ctm == 1) ? ("minute") : ("minutes"));
	return strii;
}