Converting seconds into Days/Hours/Minutes
#6

anyone can come in handy

Код:
ConvertSeconds(time)
{
	new string[128];
	if(time < 60)format(string, sizeof(string), "%d seconds", time);
	else if(time == 60)string = "1 minute";
	else if(time > 60 && time < 3600)
	{
		new Float: minutes;
		new seconds;
		minutes = time / 60;
		seconds = time % 60;
		format(string, sizeof(string), "%.0f minutes %d seconds", minutes, seconds);
	}
	else if(time == 3600)string = "1 hoiur";
	else if(time > 3600)
	{
		new Float: hours;
		new minutes_int;
		new Float: minutes;
		new seconds;
		hours = time / 3600;
		minutes_int = time % 3600;
		minutes = minutes_int / 60;
		seconds = minutes_int % 60;
		format(string, sizeof(string), "%.0f:%.0f:%d", hours, minutes, seconds);
	}
	return string;
}
use
Код:
format(string,sizeof(string),"SERVER: blahblahblah %s.",ConvertSeconds(TIME_TO_KICK));
PS days themselves split
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)