Calculating time.
#4

Sometime ago I did a race and that's what I used:

Race Starts:

pawn Код:
new tick;
tick = tickcount();
SetPVarInt(playerid, "RaceTime", tick);
Race ends:

pawn Код:
new tick, calc, tmin, tsec, tmsec;
tick = tickcount();
calc = tick - GetPVarInt(playerid, "RaceTime");
ConvertTime(calc, tmin, tsec, tmsec);
Then you just format the values tmin, tsec, tmsec into a string with %d. Oryou can do w/e you want, like formating the number with %2d, etc.

Hope you understand.

Edit:

pawn Код:
stock ConvertTime(Milliseconds, &rMin, &rS, &rMS) //don't know the creator
{
  rMin = Milliseconds/60000;
  Milliseconds -= rMin*60000;
  rS = Milliseconds/1000;
  Milliseconds -= rS*1000;
  rMS = Milliseconds;
}
Reply


Messages In This Thread
Calculating time. - by Zh3r0 - 23.06.2010, 12:19
Re: Calculating time. - by Zh3r0 - 23.06.2010, 13:06
Re: Calculating time. - by Jeffry - 23.06.2010, 14:01
Re: Calculating time. - by russo666 - 23.06.2010, 14:07
Re: Calculating time. - by Zh3r0 - 23.06.2010, 14:12

Forum Jump:


Users browsing this thread: 1 Guest(s)