Calculating player's distance from a specific location.
#1

Hi people,

I want to calculate a player's distance from a given location. For example:

pawn Код:
187.124574, -1547.457456, 51.245541 //Player's position
1547.651242, 514.515450, 50.541244 // The point the I want to calculate how far this from players position.
And how do I convert this variable to mile, meter or anything I want.
Reply
#2

As far as I know, GTA SA uses the metric system for distances. The height of an average ped in SA is 1.9, which is also the average height of a normal person in meters.

pawn Код:
stock Float:GetDistanceBetweenPoints(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2)
{
    x1 -= x2;
    y1 -= y2;
    z1 -= z2;
    return floatsqroot((x1 * x1) + (y1 * y1) + (z1 * z1));
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)