Every docs URL answers with Markdown when you add .md. Site map: llms.txt
Zone Creator
Draw a zone on the real GTA V map in 2D or 3D and copy ready code for ox_lib zones, PolyZone, ox_target and qb-target, or the points as Lua or JSON.
Deze docs zijn voorlopig in het Engels.
The Zone Creator draws a zone on the actual Los Santos map, in 2D or in the 3D world, and hands you the code for whichever zone library your server uses. Nothing is uploaded and nothing needs a game client: you click where the zone belongs, set the two heights against the real ground, and copy the block.
Quick start
- Pick a shape: Polygon, Box, Circle or Sphere.
- Click the map to drop corners (polygon) or to place the centre (the other three).
- Switch to Edit and drag things into place. Set minZ and maxZ on the right, or press Sit on the ground here to put the band on the floor under the zone.
- Open the output for your library at the bottom and copy it.
Switch to 3D world on a desktop to see the zone as the solid it really is and check it clears the counter or the fence.
Drawing and editing
| Action | How |
|---|---|
| Add a corner | Add points mode, click the map or the ground in 3D |
| Move a corner | Edit mode, drag it |
| Add a corner on an edge | Edit mode, drag the edge where you want the new corner |
| Delete a corner | Right click it, or use the bin in the Points list |
| Move the whole zone | Edit mode, drag from inside the shape |
| Set the heights in 3D | Drag the two flat discs in the middle of the zone |
| Undo / redo | Ctrl + Z and Ctrl + Y |
Changing shape keeps the zone where it is, so a polygon you drew turns into a box on the same spot.
Heights
minZ and maxZ are world z, the same numbers GetEntityCoords returns. The panel shows the ground height under the zone, read from the same height data the map uses, so the numbers mean something instead of being a guess.
Tip
A band from about a metre below the floor to two metres above it covers a player standing there. Go wider if people arrive by car, or if the floor slopes.
A sphere has no band. It is a ball around its centre, so it uses the centre z and the radius, and the two height fields are hidden.
The outputs
Every tab says which library and version it was written against, and the comments at the top of each snippet list the fxmanifest.lua lines that library needs.
ox_lib
lib.zones.poly, lib.zones.box and lib.zones.sphere, with onEnter, onExit and inside stubbed out.
Two things about ox_lib worth knowing, because the tool handles them for you:
- A poly zone is flat. Every point is put on one z and the height comes from
thickness, which is the total height centred on that plane. So a band from 28 to 34 becomes points at z 31 withthickness = 6.0. sizeon a box is the full size, androtationis the heading in degrees.
local my_zone = lib.zones.box({
name = 'my_zone',
coords = vec3(213.94, -935.61, 31.0),
size = vec3(10.0, 14.0, 6.0),
rotation = 340.0,
debug = true,
onEnter = function(self)
print('entered ' .. self.name)
end,
onExit = function(self)
print('left ' .. self.name)
end,
inside = function(self)
-- runs every frame while the player is inside
end,
})PolyZone
PolyZone:Create, BoxZone:Create or CircleZone:Create, with an onPlayerInOut handler. BoxZone takes (center, length, width, options): length runs along the heading, width across it, which the tool works out from the box you drew.
local my_zone = PolyZone:Create({
vector2(207.74, -943.21),
vector2(230.1, -943.21),
vector2(230.1, -925.4),
}, {
name = 'my_zone',
minZ = 28.0,
maxZ = 34.0,
debugPoly = true,
})
my_zone:onPlayerInOut(function(isPointInside, point)
if isPointInside then
print('entered my_zone')
end
end, 500)ox_target and qb-target
The same zone as an interaction, with one option ready to edit: a label, a Font Awesome icon, a distance and a client event. Set those four in the tool and they land in the snippet.
ox_target uses ox_lib underneath, so its zone keys are ox_lib’s. qb-target uses PolyZone, so its zone options are PolyZone’s, and the interaction lives in a separate targetoptions table.
Lua table and JSON
Just the numbers, for your own inside test or a library that is not listed here.
Shapes a library does not have
- ox_lib has no cylinder. A circle is written as a sixteen sided polygon with a thickness, which is a real bounded cylinder.
- PolyZone’s
CircleZonetakes nominZormaxZ. WithuseZ = falseit only tests x and y, so it has no top and no bottom; withuseZ = trueit is a ball. If the height matters, use a polygon there.
Point order
Neither library needs a particular winding. ox_lib reverses a clockwise ring itself before it splits the polygon into triangles, and PolyZone’s inside test does not care either way. The panel shows which way round your points run and there is a Reverse order button, which is useful when you are matching a list you already have.
What does matter is that the ring is simple: no edge may cross another. The tool flags a crossing and tells you which two edges do it.
Bringing a zone back in
Paste any of these into the box at the bottom and press Load it onto the map:
- An ox_lib, ox_target, PolyZone or qb-target snippet
- The JSON this tool produces
- A plain list of
vector2orvector3lines, or rows ofx, ynumbers
Only the shape and the heights are read back. Callbacks, target options and job checks are not.
Share links
Share link puts the whole zone in the URL, so you can send it to whoever is writing the script and they open it exactly as you drew it. The link only carries what differs from the defaults, so it stays short.
Limits
- One zone at a time. Putting several into a
ComboZoneis something you do in your own code. - A self intersecting polygon is drawn and flagged, but no library can test it correctly. Fix the crossing first.
- Over roughly 400 metres across, or past about 40 points, the per frame inside test starts to cost real time. Split the area into a few zones, or use a box.
- The 3D view needs a desktop browser with WebGL 2. The 2D map works everywhere.
