# Zones

### lib.zones.poly[​](https://overextended.github.io/docs/ox_lib/Modules/Zones/Shared#libzonespoly) <a href="#libzonespoly" id="libzonespoly"></a>

```
lib.zones.poly(data)
```

* data: `table`
  * points: `vector3[]`
    * All z values must match
  * thickness?: `number`
    * Default: `4`
  * onEnter: `function`(self: `table`)
  * onExit: `function`(self: `table`)
  * inside: `function`(self: `table`)
  * debug?: `boolean`

### lib.zones.box[​](https://overextended.github.io/docs/ox_lib/Modules/Zones/Shared#libzonesbox) <a href="#libzonesbox" id="libzonesbox"></a>

```
lib.zones.box(data)
```

* data: `table`
  * coords: `vector3`
  * size?: `vector3`
    * Default: `vec3(4, 4, 4)`
  * rotation?: `number`
    * Angle in degrees
  * onEnter: `function`(self: `table`)
  * onExit: `function`(self: `table`)
  * inside: `function`(self: `table`)
  * debug?: `boolean`

### lib.zones.sphere[​](https://overextended.github.io/docs/ox_lib/Modules/Zones/Shared#libzonessphere) <a href="#libzonessphere" id="libzonessphere"></a>

```
lib.zones.sphere(data)
```

* data: `table`
  * coords: `vector3`
  * radius?: `number`
    * Default: `2`
  * onEnter: `function`(self: `table`)
  * onExit: `function`(self: `table`)
  * inside: `function`(self: `table`)
  * debug?: `boolean`

### Usage Examples[​](https://overextended.github.io/docs/ox_lib/Modules/Zones/Shared#usage-examples) <a href="#usage-examples" id="usage-examples"></a>

```
function onEnter(self)
    print('entered zone', self.id)
end

function onExit(self)
    print('exited zone', self.id)
end

function inside(self)
    print('you are inside zone ' .. self.id)
end

local poly = lib.zones.poly({
    points = {
        vec(413.8, -1026.1, 29),
        vec(411.6, -1023.1, 29),
        vec(412.2, -1018.0, 29),
        vec(417.2, -1016.3, 29),
        vec(422.3, -1020.0, 29),
        vec(426.8, -1015.9, 29),
        vec(431.8, -1013.0, 29),
        vec(437.3, -1018.4, 29),
        vec(432.4, -1027.2, 29),
        vec(424.7, -1023.5, 29),
        vec(420.0, -1030.2, 29),
        vec(409.8, -1028.4, 29),
    },
    thickness = 2,
    debug = true,
    inside = inside,
    onEnter = onEnter,
    onExit = onExit
})

local sphere = lib.zones.sphere({
    coords = vec3(442.5363, -1017.666, 28.65637),
    radius = 1,
    debug = true,
    inside = inside,
    onEnter = onEnter,
    onExit = onExit
})

local box = lib.zones.box({
    coords = vec3(442.5363, -1017.666, 28.65637),
    size = vec3(1, 1, 1),
    rotation = 45,
    debug = true,
    inside = inside,
    onEnter = onEnter,
    onExit = onExit
})
```

Zones can be deleted by using the remove method.

```
poly:remove()
sphere:remove()
box:remove()
```

### Zone creation script[​](https://overextended.github.io/docs/ox_lib/Modules/Zones/Shared#zone-creation-script) <a href="#zone-creation-script" id="zone-creation-script"></a>

Similarly to PolyZone, there is a zone creation script included.

To use it use the `/zone` with `poly`, `box` or `sphere` as args.

Available controls will be displayed on the right side.

Once saved you will find the created zone details in created\_zones.lua within ox\_lib


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://max-workx.gitbook.io/maxworkx-private-fivem-docs/library/overextended/shared/zones.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
