> For the complete documentation index, see [llms.txt](https://viper-development-1.gitbook.io/viperdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://viper-development-1.gitbook.io/viperdocs/viper-scripts/safe-zone/developer-api/client-events.md).

# Client Events

Client-side events fired by viper-safezones.

These events are fired on the client by viper-safezones. Listen to them with `AddEventHandler` to react to changes from your own resource.

{% hint style="success" %}

#### `viper-safezones:onEnter`

Fired when the local player enters a safe zone. Fires once per zone, so entering an overlapping zone fires again.

```lua
---@param zoneId number
---@param zoneName string
---@param restrictions Restrictions
AddEventHandler("viper-safezones:onEnter", function(zoneId, zoneName, restrictions)
    print(("Entered %s"):format(zoneName))
end)
```

{% endhint %}

{% hint style="success" %}

#### `viper_safezones:onExit`

Fired when the local player leaves a safe zone.

```lua
---@param zoneId number
---@param zoneName string
---@param stillInAnotherZone boolean # True if the player is still inside another overlapping zone
AddEventHandler("viper-safezones:onExit", function(zoneId, zoneName, stillInAnotherZone)
    if not stillInAnotherZone then
        print("Left all safe zones")
    end
end)
```

{% endhint %}
