HELP with converting seconds to minutes
#1

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?
Reply
#2

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

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

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);
Reply
#5

HELP
Reply
#6

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
Reply
#7

Who can help me?
Reply
#8

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

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*
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)