Skip to content

Commit 1ca61ca

Browse files
committed
complete zones documentation
1 parent 8877c2e commit 1ca61ca

1 file changed

Lines changed: 81 additions & 13 deletions

File tree

content/docs/ox_lib/Zones/Shared.mdx

Lines changed: 81 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -182,28 +182,48 @@ zone.inside = inside;
182182

183183
Zones can be deleted by using the remove method.
184184

185+
<Tabs groupId="language" items={['Lua', 'TypeScript']}>
186+
<Tab>
185187
```lua
186-
local zone = lib.zones.box({...})
187-
188188
zone:remove()
189189
```
190+
</Tab>
191+
<Tab>
192+
```ts
193+
zone.remove()
194+
// or
195+
Zone.delete(zone.id)
196+
```
197+
</Tab>
198+
</Tabs>
190199

191200
### contains
192201

193-
Tests if a point exists inside the zone, returning a `boolean`.
202+
Evaluates whether a point is within the zone.
194203

204+
<Tabs groupId="language" items={['Lua', 'TypeScript']}>
205+
<Tab>
195206
```lua
196-
local zone = lib.zones.box({...})
207+
zone:contains(vec3(1, 1, 1))
208+
```
209+
</Tab>
210+
<Tab>
211+
```ts
212+
import { Vector3 } from "@overextended/ox_lib";
197213

198-
if zone:contains(vec3(1, 1, 1)) then
199-
print('point is inside zone!')
200-
end
214+
zone.contains(new Vector3(1, 1, 1))
201215
```
216+
</Tab>
217+
</Tabs>
218+
219+
**Returns:** `boolean`
202220

203221
### setDebug
204222

205223
Enables or disables debug mode for a zone, optionally with custom colors.
206224

225+
For JavaScript, set `zone.shouldDraw` or manually call `zone.draw(...args)`.
226+
207227
```lua
208228
local zone = lib.zones.box({...})
209229

@@ -219,30 +239,78 @@ zone:setDebug(false)
219239

220240
## Utility Functions
221241

222-
### lib.zones.getAllZones
242+
### getAllZones
223243

224244
Returns all registered zones.
225245

246+
<Tabs groupId="language" items={['Lua', 'TypeScript']}>
247+
<Tab>
226248
```lua
227-
local zones = lib.zones.getAllZones()
249+
lib.zones.getAllZones()
228250
```
229251

230-
### lib.zones.getCurrentZones
252+
**Returns:** `CZone[]`
253+
</Tab>
254+
<Tab>
255+
```ts
256+
import { Zone } from "@overextended/ox_lib";
257+
258+
Zone.getAll();
259+
```
260+
261+
**Returns:** `Set<Zone>`
262+
</Tab>
263+
</Tabs>
264+
265+
### getCurrentZones
231266

232267
Returns all zones the player is currently inside.
233268

269+
<Tabs groupId="language" items={['Lua', 'TypeScript']}>
270+
<Tab>
234271
```lua
235-
local currentZones = lib.zones.getCurrentZones()
272+
lib.zones.getCurrentZones()
236273
```
237274

238-
### lib.zones.getNearbyZones
275+
**Returns:** `CZone[]`
276+
</Tab>
277+
<Tab>
278+
```ts
279+
import { Zone } from "@overextended/ox_lib";
280+
281+
Zone.getCurrent();
282+
```
283+
284+
**Returns:** `Set<Zone>`
285+
</Tab>
286+
</Tabs>
287+
288+
### getNearbyZones
239289

240290
Returns all zones near the player.
241291

292+
<Tabs groupId="language" items={['Lua', 'TypeScript']}>
293+
<Tab>
242294
```lua
243-
local nearbyZones = lib.zones.getNearbyZones()
295+
lib.zones.getNearbyZones()
296+
```
297+
298+
**Returns:** `CZone[]`
299+
</Tab>
300+
<Tab>
301+
```ts
302+
import { Zone } from "@overextended/ox_lib";
303+
304+
Zone.getNearby(point);
244305
```
245306

307+
- point?: `Vector2` | `Vector3`
308+
- Defaults to the current player position.
309+
310+
**Returns:** `Set<Zone>`
311+
</Tab>
312+
</Tabs>
313+
246314
## Examples
247315

248316
<Tabs groupId="language" items={['Lua', 'TypeScript']}>

0 commit comments

Comments
 (0)