Convert 60 seconds to 1:00(minutes to secons)
#5

Quote:
Originally Posted by kirostar
Посмотреть сообщение
Interesting people in this community..

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
pawn Код:
stock ConvertToMinutes(time)
{
    new string[10], minutes, seconds;
    if(time > 59)
    {
        minutes = floatround(time / 60);
        seconds = floatround(time - minutes * 60);
        format(string, sizeof(string), "%02d:%02d", minutes, seconds);
    }
    else
    {
        seconds = floatround(time);
        format(string, sizeof(string), "00:%02d", seconds);
    }
    return string;
}
Small improvement:

pawn Код:
ConvertToMinutes(time)
{
    new string[10], minutes, seconds;
    minutes = floatround(time / 60);
    seconds = floatround(time - minutes * 60);
    format(string, sizeof(string), "%02d:%02d", minutes, seconds);
    return string;
}
You don't need an if check there..
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)