🤠 Wild Country Libs
Client API

Distance & Proximity

The #(GetEntityCoords(playerPed) - GetEntityCoords(ped)) < X check shows up in nearly every encounter file in wc_encounter. These four functions are that pattern, named.

GetDistance(a, b)client

Actual 3D distance between two points.

ParamType
a, bvector3 | {x,y,z}
SquaredDistance(ax, ay, az, bx, by, bz)client

Squared 3D distance — skips the sqrt call. Use this in hot loops where you only need to compare against a squared radius.

IsNearCoords(point, center, radius)client

Whether point is within radius of center. Uses the squared comparison internally.

IsPlayerNearCoords(center, radius)client

Convenience wrapper — checks the local player ped against center without you writing GetEntityCoords(PlayerPedId()) at every call site.

before — repeated across 8 encounter files
local dist = #(GetEntityCoords(PlayerPedId()) - GetEntityCoords(ped))
if dist < 3.5 then ... end
after
if wc:IsPlayerNearCoords(GetEntityCoords(ped), 3.5) then ... end