Commands#
Safezone Creator registers a single command. Everything else is done in the creator it opens.
Command | Where | Description |
|---|---|---|
| In game | Opens the creator. Framework admins and the jobs in |
There is no console command and no default keybind: zones are drawn in the world, so the creator needs a player in game. Who may open it is covered in Installation.
Client Events#
Safezone Creator does not need exports to be driven from your scripts: it tells them what is happening. Two client events fire on the player's own machine as they cross a zone's border, each carrying the zone — its full data, described below. Use them to hide a HUD, pause a job, stop a robbery from starting, or refuse any action of your own inside a safe zone.
safezone:enteredZone
Fired once when the player walks, drives or falls into a safe zone.
AddEventHandler('safezone:enteredZone', function(zone)
print(('Entered safe zone %s (#%s)'):format(zone.label, zone.id))
end)safezone:leftZone
Fired once when the player leaves it.
AddEventHandler('safezone:leftZone', function(zone)
print(('Left safe zone %s'):format(zone.label))
end)Example: is the player in a safe zone?
Zones can overlap, so count entries rather than keeping a single true/false — otherwise leaving one zone while still standing in another reads as being outside.
local zonesInside = 0
AddEventHandler('safezone:enteredZone', function()
zonesInside = zonesInside + 1
end)
AddEventHandler('safezone:leftZone', function()
zonesInside = math.max(zonesInside - 1, 0)
end)
function IsInSafeZone()
return zonesInside > 0
end
-- in your own action
if IsInSafeZone() then
return lib.notify({ type = 'error', description = 'You cannot do that in a safe zone.' })
endThe Zone Object#
What both events receive — the zone as it was saved in the creator:
Field | Type | Holds |
|---|---|---|
| number | The zone's number in the database. |
| string | Its name. |
| table | The corners, each with |
| number | The zone's height, in metres. |
| table |
|
| boolean | Whether the zone heals. |
| boolean | Whether its outline is drawn in the world. |
| boolean | Whether players are told they entered and left. |
| number | The speed limit; |
| table · table | The exempt jobs, and their exempt grades keyed by job name. |
| string · table | The exempt gang and its exempt grades. |
| table | The weapon names anybody may use inside. |
Network Events#
The server keeps every client's copy of the zones up to date with these events. They are listed so you recognise them in a log — not to be triggered by hand.
Event | Direction | Sent when |
|---|---|---|
| Client → server | The player's interface has loaded; it asks for the zones. |
| Server → client | The answer: every zone on the server. |
| Server → all clients | A zone was created. |
| Server → all clients | A zone was edited. |
| Server → all clients | A zone was deleted. Carries the zone's id. |
| Server → client | The server shows a player a message. |
A client script of yours can also listen to
safezone:setZones,safezone:addZone,safezone:updateZoneandsafezone:removeZonewithRegisterNetEventto keep its own list of where the safe zones are — to draw them on a custom map, for example.



