Convert seconds help/improve
#1

Hello,
So, can someone help me make 00:00:00 format for afk timer?
Thanks.

Код:
stock ConvertSeconds(time)
{
    new string[128];
    if(time < 60) format(string, sizeof(string), "%d seconds", time);
    else if(time == 60) string = "1 minūte";
    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 hour";
    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;
}
PS. If someone didn't understand, to timer counts hours:minuteseconds, like 00:05:12.
Reply


Messages In This Thread
Convert seconds help/improve - by thaKing - 21.07.2015, 11:25
Re: Convert seconds help/improve - by SpikY_ - 21.07.2015, 11:29
Re: Convert seconds help/improve - by thaKing - 21.07.2015, 11:46

Forum Jump:


Users browsing this thread: 1 Guest(s)