SA-MP Forums Archive
Time - 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: Time (/showthread.php?tid=288930)



Time - Luis- - 09.10.2011

Hi, can some one explain how I can get the time of something? Like, some one is flying from LS-Airport to LV-Airport. How would I get the time it took them?


Re: Time - Backwardsman97 - 09.10.2011

Are you just trying to find the time once or have a script that gives you the time each time? You could use gettime when they start and then again when they finish.


Re: Time - mitosking - 09.10.2011

Use the function "GetTickCount()". When you leave the LS-Airport save in a variable a GetTickCount(). Example:

pawn Код:
new count = GetTickCount();
When you arrive at LV-Airport, you do this:

pawn Код:
new final_count = GetTickCount() - count, string[128];
format(string, 128, "Time: %d sec.", final_count / 1000);
SendClientMessage(playerid, -1, string);
return 1;