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



Count kilometers - Despacito - 28.04.2017

Hello, i want to save the kilometers driven by a player in all vehicles. I DONT wanna save VEHICLE kilometers, i need to calculate and save how many km's a player driven with a vehicle, doesnt matter which.
How to?


Re: Count kilometers - NealPeteros - 28.04.2017

Check this FS out: https://sampforum.blast.hk/showthread.php?tid=404367


Re: Count kilometers - Despacito - 28.04.2017

Please read:

Quote:

I DONT wanna save VEHICLE kilometers, i need to calculate and save how many km's a player driven with a vehicle, doesnt matter which




Re: Count kilometers - Despacito - 29.04.2017

Bump.


Re: Count kilometers - Sew_Sumi - 29.04.2017

It doesn't take a coding legend to figure out that you get the value from that filterscript, and count it each time the player gets in and out of the car...


Re: Count kilometers - Vince - 29.04.2017

Distance = Speed x Time. Decide if you want to store distance in meters or kilometers. Set repeating timer for 1 second. Get speed in km/h. Convert to km/s (3600 seconds in an hour, so divide speed by 3600) or m/s (convert kilometers to meters (multiply by 1000) and then divide by 3600). Add value to player stat.


Re: Count kilometers - Pottus - 29.04.2017

Quote:
Originally Posted by Vince
Посмотреть сообщение
Distance = Speed x Time. Decide if you want to store distance in meters or kilometers. Set repeating timer for 1 second. Get speed in km/h. Convert to km/s (3600 seconds in an hour, so divide speed by 3600) or m/s (convert kilometers to meters (multiply by 1000) and then divide by 3600). Add value to player stat.
I think it would be better to get their position each second and if it is more than a certain tolerance (0.1 meters example) when the next position update takes place then that distance would be added to the total.