Skip to content

Exports/Events

Client exports, net events, and state bags for integrations.

All exports are client-side.


Client exports#

IsInSafezone#

Returns whether the local player is inside any active safezone session.

lua
local inside = exports['0r-safezonecreator']:IsInSafezone()

Returns#

TypeDescription
booleantrue if inside a zone

GetCurrentZoneId#

Returns the id of the zone the player is currently in.

lua
local zoneId = exports['0r-safezonecreator']:GetCurrentZoneId()
-- nil when not in a zone

Returns#

TypeDescription
string | nilZone id (e.g. safezone_hospital)

IsWhitelistedInCurrentZone#

Returns whether the local player is job-whitelisted in the zone they are standing in.

lua
local exempt = exports['0r-safezonecreator']:IsWhitelistedInCurrentZone()

Returns#

TypeDescription
booleantrue if whitelisted for the current zone

Client events#

Register these on the client when you need hooks (menus, logging, custom UI):

EventArgumentsWhen
0r-safezonecreator:client:zoneEnteredzoneId, zoneDataPlayer enters a zone
0r-safezonecreator:client:zoneLeftzoneId, zoneDataPlayer leaves a zone

Example:

lua
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:

BagValues
currentSafezoneZone 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.