> For the complete documentation index, see [llms.txt](https://docs.0resmon.org/0resmon/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.0resmon.org/0resmon/0r-resources/0r-safezonecreator/exports-events.md).

# Exports/Events

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

| Type    | Description             |
| ------- | ----------------------- |
| boolean | `true` 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

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

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

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

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.0resmon.org/0resmon/0r-resources/0r-safezonecreator/exports-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
