All exports are client-side.
Client exports#
IsInSafezone#
Returns whether the local player is inside any active safezone session.
local inside = exports['0r-safezonecreator']:IsInSafezone()
Returns#
| Type | Description |
|---|---|
| boolean | true if inside a zone |
GetCurrentZoneId#
Returns the id of the zone the player is currently in.
local zoneId = exports['0r-safezonecreator']:GetCurrentZoneId()
-- nil when not in a zone
Returns#
| Type | Description |
|---|---|
| string | nil | Zone id (e.g. safezone_hospital) |
IsWhitelistedInCurrentZone#
Returns whether the local player is job-whitelisted in the zone they are standing in.
local exempt = exports['0r-safezonecreator']:IsWhitelistedInCurrentZone()
Returns#
| Type | Description |
|---|---|
| boolean | true if whitelisted for the current zone |
Client events#
Register these on the client when you need hooks (menus, logging, custom UI):
| Event | Arguments | When |
|---|---|---|
0r-safezonecreator:client:zoneEntered | zoneId, zoneData | Player enters a zone |
0r-safezonecreator:client:zoneLeft | zoneId, zoneData | Player leaves a zone |
Example:
AddEventHandler('0r-safezonecreator:client:zoneEntered', function(zoneId, zoneData)
print(('entered %s (%s)'):format(zoneId, zoneData.name))
end)
zoneData is the full zone table from data/zones.json (points, general settings, blip, job whitelist, etc.).
State bag#
The script sets a player state bag while inside a zone:
| Bag | Values |
|---|---|
currentSafezone | Zone id string while inside; cleared on exit |
Other resources can read LocalPlayer.state.currentSafezone on the client, or the equivalent on other players from the server if replicated.
Integrating with other resources#
Zone creation and updates are handled through the in-game editor and admin command. For other scripts, use the client exports and client events above — do not try to manage zones from external code unless you maintain your own copy of data/zones.json and accept sync limitations.