їTransformar tiempo a minutos y segundos de gettime?
#1

Hola quisiera saber si se puede transformar un tiempo tomado con gettime a segundos y minutos como lo hace este cуdigo

Код:
stock Convertir(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;
}
lo estaba usando de la siguiente manera

Код:
format(string, ..."tiempo: %s", Convertir(TemporizadorGlobal[3]));
en un texto que mostraria supuestamente los segundos y minutos que se tardу pero al mostrar el mensaje salen un numero demasiado grande y quiero saber si se puede transformar los segundos tomados con gettime a minutos y segundos, gracias.
Reply
#2

Podrнas probar asн:

pawn Код:
stock Convertir(time)
{
    new string[10], minutes, seconds;
    time = gettime() - time;
    minutes = time / 60;
    seconds = time - (minutes*60);
    format(string, sizeof(string), "%02d:%02d", minutes, seconds);
    return string;
}
Reply
#3

Quote:
Originally Posted by [J]ulian
Посмотреть сообщение
Podrнas probar asн:

pawn Код:
stock Convertir(time)
{
    new string[10], minutes, seconds;
    time = gettime() - time;
    minutes = time / 60;
    seconds = time - (minutes*60);
    format(string, sizeof(string), "%02d:%02d", minutes, seconds);
    return string;
}
Mucho mejor gracias Julian siempre ayudando
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)