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



Question - enzulikeS - 26.02.2018

How I can do this:

A checkpoint has been set to the destination. Distance (x m).

How I can take the distance from player to checkpoint?


Re: Question - Stuntff - 26.02.2018

Use GetDistanceBetweenPoints.

Код:
stock Float:GetDistanceBetweenPoints(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2)
{
	return VectorSize(x1-x2, y1-y2, z1-z2);
}

new Float:distance = GetDistanceBetweenPoints(x1, y1, z1, x2, y2, z2);

printf("distance: %.1f", distance);



Re: Question - enzulikeS - 26.02.2018

ty

where can i find a wiki page for this? i want to learn more about that one


Re: Question - PepsiCola23 - 26.02.2018

It`s better to use
PHP код:
GetPlayerDistanceFromPoint 
instead of
PHP код:
GetDistanceBetweenPoints 
here.

here you have the wiki link:

https://sampwiki.blast.hk/wiki/GetPlayerDistanceFromPoint


Re: Question - enzulikeS - 26.02.2018

ty so muuch