🤠 Wild Country Libs
Client API

Zone checks

Radius-based zone exclusion helpers. No framework required. Uses squared-distance comparison — no sqrt per call.

Zone format

Each zone is a table with the following fields:

FieldTypeDescription
xnumberWorld X coordinate.
ynumberWorld Y coordinate.
znumberWorld Z coordinate.
radiusnumberExclusion radius in metres.
namestring | nilOptional zone name returned by the check functions.
IsInsideZone(pos, zones) → boolean, string|nilclient

Returns inside, zoneName. zoneName is nil if not inside any zone.

ParamTypeDescription
posvector3 | tablePosition to test — vector3 or {x, y, z}.
zonestableArray of zone tables.
IsPlayerInsideZone(zones) → boolean, string|nilclient

Convenience wrapper — uses GetEntityCoords(PlayerPedId()) as the position.

ParamTypeDescription
zonestableArray of zone tables.
example
local NO_SPAWN_ZONES = {
  { x = -802.0, y = -1305.0, z = 43.0,  radius = 150.0, name = 'Blackwater' },
  { x = 2559.0, y =  438.0,  z = 57.0,  radius = 200.0, name = 'Annesburg'  },
}

-- in a spawn loop thread:
local inside, zoneName = wc:IsPlayerInsideZone(NO_SPAWN_ZONES)
if inside then
  print('Player is inside ' .. tostring(zoneName) .. ' — skipping spawn')
end

Real Wild County example — stagecoach mission exclusion zones

wc_stagecoach skips generating delivery missions that start or end inside major towns, keeping the "roadside" feel of the job.

wc_stagecoach/client/main.lua
local inside = wc:IsInsideZone(candidatePos, Config.TownZones)
if inside then return end -- pick a different delivery point

Common mistakes

Troubleshooting