SA-MP Forums Archive
їTransformar tiempo a minutos y segundos de gettime? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: їTransformar tiempo a minutos y segundos de gettime? (/showthread.php?tid=543806)



їTransformar tiempo a minutos y segundos de gettime? - Pipe98 - 29.10.2014

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.


Respuesta: їTransformar tiempo a minutos y segundos de gettime? - [J]ulian - 29.10.2014

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;
}



Respuesta: їTransformar tiempo a minutos y segundos de gettime? - Pipe98 - 29.10.2014

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