ZoneManager - A polyzone creation and management resource

ZoneManager

A standalone, framework-agnostic FiveM resource for drawing, saving, and querying 3D polygon and circle zones. Ships with an in-game free-cam viewer and a 2D Leaflet map editor.


Framework Standalone Svelte License


Preview


Features

  • Polygon + circle zones - draw a ring of points or a center + radius, each with a per-zone height.
  • 2D map editor - place, drag, insert, and delete points on a Leaflet GTA map; live distance + grid overlays.
  • In-game viewer - free-cam over the zone with walls drawn in world space; nudge the height live.
  • Framework-agnostic - standalone (cfx ace), ESX, QBCore, Qbox, or your own. One setting.
  • Simple API - Enable / Disable / IsEnabled, AttachZoneToEntity, and OnEnter / OnExit subscriptions.
  • Server-authoritative - the editor command and every save are gated server-side, so the editor can’t be reached by forging an event.

Installation

# drop into your resources folder
cd resources
git clone https://github.com/itsxScrubz/fivem-zonemanager zonemanager
# server.cfg - after your framework, if any
ensure zonemanager

# standalone admin grant (skip if using a framework adapter)
add_ace group.admin zonemanager.editor allow

Then /zonemanager in-game (as an admin) opens the editor.


Configuration

Two settings in config.lua:

Key Default Options
config.framework 'standalone' standalone | esx | qbcore | qbox | custom
config.callbacks 'internal' internal | framework

config.framework picks the admin check. config.callbacks picks how the editor talks to the server - internal works everywhere.

framework uses the framework’s native callbacks.


API

From any other resource:

local ZoneManager = exports.zonemanager:FetchModule()

ZoneManager:OnEnter(function(name) print('entered', name) end)
ZoneManager:OnExit(function(name)  print('left', name) end)

ZoneManager:Enable('legion_square')
print(ZoneManager:IsEnabled('legion_square'))

Also: Disable(name), AttachZoneToEntity(name, entity, opts?) / DetachZone(name), SetZoneDebug(name, on), and GetZones() server-side.

AttachZoneToEntity opts: useZ (full 3D box vs flat footprint), padding (grow the box by N meters on every side), debug (draw the box in-world for testing - toggle live with SetZoneDebug).


FAQ

Do I need a framework? No. `config.framework = 'standalone'` uses cfx ace and needs no framework at all.
Can players open the editor? Only admins. Both the `/zonemanager` command and the save path are gated server-side.
Are the framework adapters tested? The standalone path is. ESX / QBCore / Qbox adapters ship but are untested - framework-integration fixes come via PRs.

Download Link - GitHub

Credits

Full credits to the resources below. I came across ZoneCreator which gave me the original idea to actually fold in the polyzone resource into the creation tool to stand as a singular complete system. Please check them out below! <3

ZoneCreator for the original idea.
PolyZone for the engine behind this resource.

1 Like

?

Yes. I gave credits to that resource inside the README.md on my github since this is originally what gave me the idea. However I folded in the actual polyzone resource (which I also gave credit to) to become a complete all in 1 system. The resource you linked allows you to export the code via the clipboard to use inside other resources and such to create the zone via the polyzone resource. Mine actually creates the polyzone internally and supplies an api to hook into those created zone. I basically merged both resources into a singular management tool.

While the ui might have some similarities since I honestly liked his design and kinda went with the same general idea, I did rewrite everything in svelte to stay away from the heavyness of the virtual dom and completely rewrote EVERYTHING from the ground up to integrate his original idea and the polyzone code into a single place.

~edit~
I went ahead and updated my original post to give credits to both resources here on this forum since they were already given credit on my github repo as well. :slight_smile:

1 Like