Distance calculation - 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: Distance calculation (
/showthread.php?tid=428425)
Distance calculation -
dominik523 - 05.04.2013
Hey everybody! Does someone know how would I create some distance calculations in my code. For example, there is hospital in los santos and in san fierro, I'm standing little bit closer to los santos, and when I die ( just for example ), I will spawn in hospital which is closer to me. Thank you for your support, I appreciate it.
Re: Distance calculation -
HurtLocker - 05.04.2013
https://sampwiki.blast.hk/wiki/GetPlayerDistanceFromPoint ****** man... ******... Under OnPlayerDeath add some if's comparing the 2 distances. If closer to the 1st building, give a value to a variable, if closest to the other, another value to the same variable like closest[playerid]=1 or 2 depending to which building you died more closely. Then under OnPlayerSpawn you use this variable with 2 if's to say where to spawn.
Re: Distance calculation -
dominik523 - 05.04.2013
thanks