# getDistanceBetweenPoints2D (Shared)

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

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Data and utilities
- **URL**: https://wiki.mymp.gg/en/getDistanceBetweenPoints2D

## Syntax

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

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `x1, y1, z1` | `float` | The first point. A `vec3` also works. |
| `x2, y2, z2` | `float` | The second point. A `vec3` also works. |

## Returns

The distance.

## Example

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

## See also

- [getDistanceBetweenPoints3D (Shared)](https://wiki.mymp.gg/en/getDistanceBetweenPoints3D.md): Measures the straight-line distance between two points in space.
