Calculating time.
#1

Can someone please show me exactly how to calcuate time?
Like the time traveled from checkpoint A to B?
I heard i must use GetTickCount but have no idea how?
I would be gratefull to the one who shows me, thanks(I want seconds too)
Reply
#2

Sorry for the bump but i really need this i can't find it anywhere, thanks again
Reply
#3

I had the same problem for my races.

This may help you: http://forum.sa-mp.com/index.php?topic=158971.0
Reply
#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
#5

Thanks both of you Glad i got an answer, thanks again!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)