---
description: Check the instructions below.
---

# Configuration

#### Zone Settings

Define multiple safe zones with unique properties under the `Zones` table.

**Zone Example:**

```lua
["main_zone"] = {
    coords = vector3(-1832.2600, -1205.6547, 14.2980), -- Center of the safe zone
    radius = 70.0,                                     -- Radius of the zone
    blipOptions = {
        active = false,                                -- Show blip on the map (true/false)
        color = 2,                                     -- Blip color
        scale = 1.0,                                   -- Blip scale
        name = "Coast Side Safezone"                   -- Blip name
    },
    options = {
        mergePlayers = true,                           -- Merge players (e.g., avoid collisions)
        mergeVehicles = true,                          -- Merge vehicles
        mergePlayerAndVehicles = true,                 -- Merge players and vehicles
        disableShooting = true,                        -- Disable shooting
        disableMelee = true                            -- Disable melee attacks
    }
}
```

| Field                     | Description                                | Example Value      |
| ------------------------- | ------------------------------------------ | ------------------ |
| `coords`                  | Center coordinates of the safe zone.       | `vector3(x, y, z)` |
| `radius`                  | Radius of the zone in meters.              | `70.0`             |
| `blipOptions.active`      | Enable or disable map blip for the zone.   | `true` or `false`  |
| `blipOptions.color`       | Color of the map blip.                     | `2`                |
| `blipOptions.scale`       | Scale of the map blip.                     | `1.0`              |
| `blipOptions.name`        | Name displayed on the map blip.            | `"Safezone"`       |
| `options.mergePlayers`    | Enable player merging to avoid collisions. | `true`             |
| `options.mergeVehicles`   | Enable vehicle merging.                    | `true`             |
| `options.disableShooting` | Disable shooting in the zone.              | `true`             |
| `options.disableMelee`    | Disable melee attacks in the zone.         | `true`             |

***

#### Localization

Edit the `Locales` table to customize messages displayed when entering or leaving a safe zone.

| Key            | Default Value                | Description                              |
| -------------- | ---------------------------- | ---------------------------------------- |
| `entered_zone` | `"~g~Entraste na Safezone."` | Message shown when entering a safe zone. |
| `left_zone`    | `"~r~Saiste da Safezone."`   | Message shown when leaving a safe zone.  |

***

### API Reference

The script provides several client and server-side exports for easy integration into other scripts.

#### Client-Side Exports

| Function Name      | Description                                                                               | Output                       |
| ------------------ | ----------------------------------------------------------------------------------------- | ---------------------------- |
| `GetClosestZone()` | Returns the closest safe zone to the player (useful for respawn systems).                 | Zone key (string)            |
| `GetCurrentZone()` | Returns the key of the zone the player is currently in. Returns `false` if not in a zone. | Zone key (string) or `false` |
| `InSafeZone()`     | Checks if the player is in a safe zone.                                                   | `true` or `false`            |

#### Server-Side Exports

| Function Name               | Description                                                                         | Output                     |
| --------------------------- | ----------------------------------------------------------------------------------- | -------------------------- |
| `GetPlayersInZone(zoneKey)` | Returns an array of player resources currently in the specified zone.               | `[player1, player2, ...]`  |
| `GetPlayerZone(source)`     | Returns the current zone of a player. Returns `nil` if the player is not in a zone. | Zone key (string) or `nil` |
| `InSafeZone(source)`        | Checks if a specific player is in a safe zone.                                      | `true` or `false`          |
