Convert seconds to minutes and seconds
#1

Hello,

I'm trying to convert seconds, to minutes and seconds. For example 119 seconds, would be 1 minute and 59 seconds.

How do I do that in PAWN? This is what I got so far, probably totally wrong:

pawn Код:
new string[128], timeTotal, minutes, secondss, seconds, secondsinstring;
                timeTotal = gettime() - PInfo[playerid][StartTime];
                minutes = timeTotal / 60;
                sscanf(minutes, "p<.>ii", minutes, secondss);
                format(string, sizeof(string), "0.%d", secondss);
                sscanf(string, "i", seconds);
                secondsinstring = seconds * 60;
Anyone who could help me out with this?

Thanks!
Reply
#2

seconds / 60 = minutes, remainder would be seconds

new minutes = floatround(seconds / 60,floatround_floor);
new remainder = seconds % 60;
Reply
#3

I've found the solution by using this:

http://forum.sa-mp.com/showpost.php?...&postcount=973

Though thanks for the effort.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)