[HELP ] Problem with the Race Timer.
#1

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;
}
Reply
#2

" minutes then seconds then miliseconds "

You mean MINUTES:SECONDS:MS ?
Reply
#3

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

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;

Reply
#5

still there is a problem. have a look here

Reply
#6

anyone else please.
sorry for the bump
Reply
#7

try with this format

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

still same problem.

Reply
#9

Please i really want help.
its still not fixed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)