Skip to main content

Zones

The Zones module provides zone creation and management. Currently bridges ox_lib zones.

Client Functions

GetResourceName

Returns the zones resource name.

local name = Bridge.Zones.GetResourceName()
-- Returns: string (always "default")

Description: Returns the name of the Zones module resource. Used for internal identification. Always returns "default" for the built-in Zones module.

Create

Creates a new zone.

local zone = Bridge.Zones.Create(type, data)
-- Returns: zone object
ParameterTypeDescription
typestringZone type: 'box', 'sphere', or 'poly'
datatableZone configuration (see below)

Zone Data Format

local zone = Bridge.Zones.Create('box', {
coords = vector3(100.0, 200.0, 30.0),
size = vector3(10.0, 10.0, 5.0),
rotation = 45.0,
debug = false,
onEnter = function(self)
print('Entered zone')
end,
onExit = function(self)
print('Exited zone')
end,
inside = function(self)
-- Called every frame while inside
end
})

Destroy

Destroys a zone by ID.

Bridge.Zones.Destroy(id)
ParameterTypeDescription
idanyZone identifier

DestroyByResource

Destroys all zones created by a specific resource.

Bridge.Zones.DestroyByResource(resource)
ParameterTypeDescription
resourcestringResource name

Get

Returns a zone object by ID.

local zone = Bridge.Zones.Get(id)
-- Returns: zone object | nil
ParameterTypeDescription
idanyZone identifier