Distance between two points
#1

Hi. I need to know which is the distance between these two points:
-2545.3506,-474.8006
595.0517,2698.5789
That are X and Y coordinates from GTA:SA, I just need the distance thanks for help
Reply
#2

pawn Код:
stock Float:Distance2D(Float:x1, Float:y1, Float:x2, Float:y2, bool:sqrt = true)
{
  x1 -= x2;
  x1 *= x1;

  y1 -= y2;
  y1 *= y1;

  x1 += y1;

  return sqrt ? floatsqroot(x1) : x1;
}
pawn Код:
new Float:distance = Distance2D(-2545.3506, -474.8006, 595.0517, 2698.5789);
Reply
#3

Using the above script I made it to be: 4464.578613
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)