SA-MP Forums Archive
HELP with converting seconds to minutes - 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)
+--- Thread: HELP with converting seconds to minutes (/showthread.php?tid=481336)



HELP with converting seconds to minutes - skydux123 - 15.12.2013

Hello I have one little problem I want to convert seconds to minutes, minutes to hours and I have code:
Код HTML:
		    JAILLAIKAS[ playerid ] --;
		    new str[70];
		    new hours, minutes, seconds = JAILLAIKAS[playerid];
		    if(seconds >= 60)
		    {
		        minutes ++;
		        seconds-=60;
			}
			if(minutes >= 60)
			{
			    hours++;
			    minutes -=60;
			}
	    	format(str, 70, "~n~~n~~n~~n~~n~~n~~w~Liko sedet:~r~%d val %d min %d sec",valandos,minutes, sekundes);
	    	GameTextForPlayer(playerid, str, 1000, 5);
I have did sekonds on myself 8000 but the server print: Liko sedet: 0val 1min 8000sec. What I did bad with this?


Re: HELP with converting seconds to minutes - Zamora - 15.12.2013

I don't understand the code but you can do it by
pawn Код:
seconds*60



Re: HELP with converting seconds to minutes - Hybris - 15.12.2013

1 second =1000
60 seconds =60000
I think you get the point from here on


Re: HELP with converting seconds to minutes - skydux123 - 15.12.2013

Quote:
Originally Posted by Hybris
Посмотреть сообщение
1 second =1000
60 seconds =60000
I think you get the point from here on
Something like this?
Код HTML:
		    JAILLAIKAS[ playerid ] --;
		    new str[70];
		    new hours, minutes, seconds = JAILLAIKAS[playerid];
		    if(sekundes >= 60000)
		    {
		        minutes ++;
		        seconds -=60000;
			}
			if(minutes >= 60)
			{
			    hours ++;
			    minutes -=60;
			}
	    	format(str, 70, "~n~~n~~n~~n~~n~~n~~w~Liko sedet:~r~%d val %d min %d sec",hours,minutes, seconds);
	    	GameTextForPlayer(playerid, str, 1000, 5);



Re: HELP with converting seconds to minutes - skydux123 - 15.12.2013

HELP


Re: HELP with converting seconds to minutes - skydux123 - 15.12.2013

Quote:
Originally Posted by Zamora
Посмотреть сообщение
I don't understand the code but you can do it by
pawn Код:
seconds*60
The seconds who are in the code it aren't mili seconds it's seconds


Re: HELP with converting seconds to minutes - skydux123 - 15.12.2013

Who can help me?


Re: HELP with converting seconds to minutes - iOxide - 15.12.2013

In samp timer 1000 miliseconds = 1 seconds, and 6000 miliseconds = 1 minute, now you should calculate it by yourself.


Re: HELP with converting seconds to minutes - Hansrutger - 15.12.2013

Quote:
Originally Posted by iOxide
Посмотреть сообщение
In samp timer 1000 miliseconds = 1 seconds, and 6000 miliseconds = 1 minute, now you should calculate it by yourself.
60000 miliseconds = 1 minute*


Re: HELP with converting seconds to minutes - iOxide - 15.12.2013

Quote:
Originally Posted by Hansrutger
Посмотреть сообщение
60000 miliseconds = 1 minute*
Oh yeah, xD thanks for the correction.