# Server Exports

## IsProtectedZone

This export calculate if the player is inside a protected zone.

```lua
-- coords must be a vector3 object about the coordenates to check
exports['p6_zones']:IsProtectedZone(coords)
```

Output: `boolean, vector3, vector4`

* `boolean` (true/false) that indicates if the player is inside a protected zone.
* `vector3` contains the safe zone for the specified coords.
* `vector4` contains the safe zone coordinates and radius specified in the config file for this protected zone.

## IsPveZone

This export calculate if the player is inside a PvE zone.

```lua
-- coords must be a vector3 object about the coordenates to check
exports['p6_zones']:IsPveZone(coords)
```

Output: `boolean, vector4`

* `boolean` (true/false) that indicates if the player is inside a PvE zone.
* `vector4` contains the PvE zone coordinates and radius specified in the config file for this PvE zone.

## IsPvPZone

This export calculate if the player is inside a PVP zone.

```lua
-- coords must be a vector3 object about the coordenates to check
exports['p6_zones']:IsPvPZone(coords)
```

Output: `boolean, vector4`

* `boolean` (true/false) that indicates if the player is inside a PvP zone.
* `vector4` contains the PvP zone coordinates and radius specified in the config file for this PvP zone.

## IsSafeZone

This export calculate if the player is inside a safe zone.

```lua
-- coords must be a vector3 object about the coordenates to check
exports['p6_zones']:IsSafeZone(coords)
```

Output: `boolean, vector4`

* `boolean` (true/false) that indicates if the player is inside a safe zone.
* `vector4` contains the safe zone coordinates and radius specified in the config file for this safe zone.

## SafeAllowNeeds

This export indicates if the zone in the specified coords allows the player to use the bathroom. Can be used with the mod "P6 Additional Needs".

```lua
-- coords must be a vector3 object about the coordenates to check
exports['p6_zones']:SafeAllowNeeds(coords)
```

Output: `boolean`

* `boolean` (true/false) that indicates if the zone in that coords allows.

## SafeAllowEmote

This export indicates if the zone in the specified coords allows the player to perform the specified emote. It is necessary to configure the emotes script. Check the Installation section.

```lua
-- coords must be a vector3 object about the coordenates to check
exports['p6_zones']:SafeAllowEmote(coords, emoteName)
```

Output: `boolean`

* `boolean` (true/false) that indicates if the zone in that coords allows the specified emote.

## For example:

```lua
local isProtected, greenCoords, redZone = exports['p6_zones']:IsProtectedZone(coords)

if isProtected then
    print("The zone is: " .. redZone.x .. redZone.y .. redZone.z)
end
```
