M MY Multiplayer: Wiki
Side
Kind

getDistanceBetweenPoints2D

Shared

Measures the distance between two points on the horizontal plane, ignoring height.

float getDistanceBetweenPoints2D(float x1, y1, z1, float x2, y2, z2)

Parameters

NameTypeDescription
x1, y1, z1floatThe first point. A vec3 also works.
x2, y2, z2floatThe second point. A vec3 also works.

Returns

The distance.

Example

local a = getElementPosition(playerA)
local b = getElementPosition(playerB)
if getDistanceBetweenPoints2D(a, b) < 50 then
    print("close on the map")
end

See also