07.12.2009, 19:48
have the same problem, i tried to use gettick and GetTickCount (both the same on windows) and after this to convert the time into min,sec,milisec, but i always return 0, example:
0:0.0
need help,
greetz
0:0.0
pawn Code:
public OnPlayerEnterRaceCheckpoint(playerid)
{
new time = 0;
if(CURRENTCP[playerid] == 1)
{
time = GetTickCount();
}
RaceInfo[Checkpoints] = dini_Int("/Races/CurrentRace.txt","Checkpoints");
new MAXRACECPS = RaceInfo[Checkpoints];
if(CURRENTCP[playerid] == MAXRACECPS)
{
new min1,sec,milis;
ConvertTime(time,min1,sec,milis);
DisablePlayerRaceCheckpoint(playerid);
new name[24],string[128];
GetPlayerName(playerid,name,24);
format(string,128,"%s finished first :O(%d:%d.%d)",name,min1,sec,milis);
SendClientMessage(playerid,THIAZ_YELLOW,string);
PlayerPlaySound(playerid, 1076, 0.0, 0.0, 0.0);
}
pawn Code:
stock ConvertTime(time, &minutes, &seconds, &milliseconds)
{
for(new i; i<1000; i++) {
if(time >= 1000) {
time = time-1000;
seconds++;
if(seconds == 60) {
seconds = 0;
minutes++;
}
}else{
milliseconds = time;
break;
}
}
}
greetz