跳到主内容

区域创建器

把区域画在它真正该在的位置。在洛圣都地图或 3D 世界里点击生成顶点,对照真实地面设置上下两个高度,然后复制 ox_lib zones、PolyZone、ox_target 或 qb-target 的现成代码,或者只取 Lua 表或 JSON 格式的点位。已有的区域可以粘贴回来继续编辑,整个区域还能做成链接分享。

这个工具和它的说明目前是英文的。

配置与代码区域, PolyZone, Target, 3D查看文档

Drawing the zone

  • Add points drops a corner wherever you click. Edit moves them: drag a corner, drag an edge to add a corner there, drag inside the shape to move the whole zone. Right click a corner to delete it.
  • Ctrl + Z undoes, Ctrl + Y redoes. Every drag counts as one step.
  • The 3D view draws the zone as the solid it really is, the prism between minZ and maxZ, so you can see whether it clears a counter or cuts through a roof. Drag the two flat discs in the middle to set the heights.
  • Switching shape keeps the zone where it is, so a polygon you drew becomes a box in the same spot.

Heights

  • minZ and maxZ are world z, the same numbers GetEntityCoords gives you. The panel shows the ground height under the zone, read from the same height grid the map uses.
  • A band from about a metre below the floor to two metres above covers a player standing there. Go wider if people arrive in a car or the floor is not flat.
  • A sphere has no band: it is a ball around its centre, so it uses the centre z and the radius instead.

What each output is

OutputWhat it gives you
ox_liblib.zones.poly, .box or .sphere with onEnter, onExit and inside stubbed.
PolyZonePolyZone:Create, BoxZone:Create or CircleZone:Create with an onPlayerInOut handler.
ox_targetThe same zone as an interaction: addPolyZone, addBoxZone or addSphereZone with one option that fires a client event.
qb-targetAddPolyZone, AddBoxZone or AddCircleZone with the matching targetoptions table.
Lua table / JSONJust the numbers, for your own inside test or a library not listed here.

Each tab says which version of the library it was written against, and the comments at the top of every snippet list the fxmanifest lines that library needs.

Shapes the libraries do not have

  • ox_lib has no cylinder, so a circle is written as a sixteen sided polygon with a thickness.
  • PolyZone's CircleZone takes no minZ or maxZ. With useZ = false it tests x and y only, which is a cylinder with no top and no bottom; with useZ = true it is a ball. If the height matters there, use a polygon.

Bringing a zone back

Paste a zone from any of the four libraries, the JSON from this tool, or just a list of vector2 orvector3 lines, and it lands on the map ready to edit. Callbacks and target options are not read back, only the shape and the heights.

Limits

  • One zone at a time. Combining several into a ComboZone is something you do in your own code.
  • A self intersecting polygon is flagged and drawn, but no library can test it correctly. Fix the crossing before you ship it.
  • Everything runs in your browser. Nothing is uploaded and nothing is saved on a server.