Making a number into a Time - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Making a number into a Time (
/showthread.php?tid=83138)
Making a number into a Time -
zallomallo - 22.06.2009
I am working on my jail system and I have a little timer to show you how much time you have left. However if you are given say 200 IG minutes I want to make that be 2:33 for 2 hours and 33 minutes IG. Any help? Thanks.
Re: Making a number into a Time -
[nl]daplayer - 22.06.2009
Quote:
Originally Posted by zallomallo
I am working on my jail system and I have a little timer to show you how much time you have left. However if you are given say 200 IG minutes I want to make that be 2:33 for 2 hours and 33 minutes IG. Any help? Thanks.
|
pawn Код:
new time[8];
format(time, 8, "%2.2", minutes/60);
new splitted[2][4];
split(time, splitted, ".");
format(time, 8, "%s:%s");
dont know if it works but i am on my psp, so cant test it
Re: Making a number into a Time -
Nero_3D - 22.06.2009
Quote:
Originally Posted by .:NoZer0:.
pawn Код:
new time[8]; format(time, 8, "%2.2", minutes/60); new splitted[2][4]; split(time, splitted, "."); format(time, 8, "%s:%s");
dont know if it works but i am on my psp, so cant test it
|
Just use your brain,
Example Minutes: 150
150 / 60 = 2.5
... split code
2:5 (should be 2:30)
pawn Код:
new string[6]; //I expect that you have a variable called 'Minutes'
format(string, sizeof string, "%02d:%02d", (Minutes / 60), (Minutes % 60));
Re: Making a number into a Time -
[nl]daplayer - 23.06.2009
Quote:
Originally Posted by ♣ ⓐⓢⓢ
Quote:
Originally Posted by .:NoZer0:.
pawn Код:
new time[8]; format(time, 8, "%2.2", minutes/60); new splitted[2][4]; split(time, splitted, "."); format(time, 8, "%s:%s");
dont know if it works but i am on my psp, so cant test it
|
Just use your brain,
Example Minutes: 150
150 / 60 = 2.5
... split code
2:5 (should be 2:30)
pawn Код:
new string[6]; //I expect that you have a variable called 'Minutes' format(string, sizeof string, "%02d:%02d", (Minutes / 60), (Minutes % 60));
|
Lol, i am in first grade, and i typed it on my psp, so couldn't test it, i have a 5 for maths
xD