PDA

View Full Version : Question


enzulikeS
26/02/2018, 04:28 PM
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?

Stuntff
26/02/2018, 04:35 PM
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);

enzulikeS
26/02/2018, 04:40 PM
ty

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

PepsiCola23
26/02/2018, 04:42 PM
It`s better to use GetPlayerDistanceFromPoint instead of GetDistanceBetweenPoints here.

here you have the wiki link:

http://wiki.sa-mp.com/wiki/GetPlayerDistanceFromPoint

enzulikeS
26/02/2018, 04:43 PM
ty so muuch