SA-MP Forums Archive
[HELP ] Problem with the Race Timer. - 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 ] Problem with the Race Timer. (/showthread.php?tid=577271)



[HELP ] Problem with the Race Timer. - SpikY_ - 10.06.2015

Hellu,
As you can see my signature. atm i'm working on map changing gamemode. So i was creating race mission.
let me tell you the actual problem.

I was trying to create a timer system which tells people how much minutes/seconds they took to complete the race. And i create that system correctly lol. but when i test it So it shows me something like this:

Look at the end of the line. its written " (42:55.203) ". the 42 is seconds i think and other miliseconds.


I want it to be like this " minutes then seconds then miliseconds "

Here are the codes:

Код:
new rTestcount;

public OnPlayerEnterRaceCheckpoint(playerid)
{
switch(Stats[playerid])
{
case 0:
{
format(string, sizeof(string), "{7077FF}» {FFFF00}%s {7077FF}Has Finshed the Race {FFFF00}[%d%s] [FPS: %d] (%s)", name, place, (place == 1) ? ("st") : (place == 2) ? ("nd") : (place == 3) ? ("rd") : ("th"), pFPS, ConvertTime(GetTickCount() - rTestcount));
SendClientMessageToAll(green, string);
rTestcount=GetTickCount();
return 1;
}
}
return 1;
}

stock ConvertTime(time)
{
	new str[16];
    new minutes=time/60000;
    new ms=time-((minutes)*60000);
    new seconds=(ms)/1000;
    ms-=seconds*1000;
	format(str,sizeof(str),"%02d:%02d.%03d",minutes,seconds,ms);
	return str;
}



Re: [HELP ] Problem with the Race Timer. - AlexBlack - 10.06.2015

" minutes then seconds then miliseconds "

You mean MINUTES:SECONDS:MS ?


Re: [HELP ] Problem with the Race Timer. - SpikY_ - 10.06.2015

lol sorry. i forgot to tell that. the race was too small. that would be finish in 30-40 seconds. 42 minutes are actually 42 seconds. that 42 seconds took place of minutes. i mean like that.
Sorry i just forgot to tell this thing.


Re: [HELP ] Problem with the Race Timer. - AlexBlack - 10.06.2015

Okay, so i think the value of minutes / seconds / ms is false, try this

PHP код:
stock ConvertTime(time)
{
    new 
str[16];
    new 
minutes = (time/ (1_000 60));
    new 
seconds= (time/ (1_000)) % 60;
    new 
ms= (time % (1_000)) / 10;
    
format(str,sizeof(str),"%02d:%02d.%03d",minutes,seconds,ms);
    return 
str;




Re: [HELP ] Problem with the Race Timer. - SpikY_ - 10.06.2015

still there is a problem. have a look here




Re: [HELP ] Problem with the Race Timer. - SpikY_ - 10.06.2015

anyone else please.
sorry for the bump


Re: [HELP ] Problem with the Race Timer. - AlexBlack - 10.06.2015

try with this format

PHP код:
    format(str,sizeof(str),"%d:%02d:%02d",minutes,seconds,ms); 



Re: [HELP ] Problem with the Race Timer. - SpikY_ - 10.06.2015

still same problem.




Re: [HELP ] Problem with the Race Timer. - SpikY_ - 10.06.2015

Please i really want help.
its still not fixed.