01.09.2017, 11:40
Greedings,how can i make detect how many kilometers players passed.
Distance = speed / time.
Set a 1 second timer (easiest). In the timer get the current speed. If it's in km/h then You need to get it down to either km/s or m/s depending on whether you store kilometers or meters. To get km/s divide speed by 3600. To get m/s multiple multiply speed by 1000 to get meters per hour and then divide by 3600. Then you still need to multiply the end result by the timer interval (in seconds). But since a * 1 = a that step can be skipped if the interval is one second. |
Distance = speed / time.
Set a 1 second timer (easiest). In the timer get the current speed. If it's in km/h then You need to get it down to either km/s or m/s depending on whether you store kilometers or meters. To get km/s divide speed by 3600. To get m/s multiple multiply speed by 1000 to get meters per hour and then divide by 3600. Then you still need to multiply the end result by the timer interval (in seconds). But since a * 1 = a that step can be skipped if the interval is one second. |
"Distans дr ett mеtt pе hur lеngt ifrеn varandra tvе objekt дr."
English translation: "Distance is a scantling of how far away two objects is." Wouldn't it be better to compare the distance from coordinates A to B? Like, set a 1000 MS timer and save the coordinates as "old", then subtract the old coordinates with the current coordinations and add the X and Y together, leaving a 2D distance traveled. Not sure whatever is better and more optimized but yeah, just a thought. |
I think here's what you looking for https://sampforum.blast.hk/showthread.php?tid=91815
next time better use "search" tool before posting threads. |
@Debjit it is the include forum -_-. A better link would be https://sampforum.blast.hk/showthread.php?tid=404367
|