> For the complete documentation index, see [llms.txt](https://docs.yeistudios.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yeistudios.com/scripts/safe-zone/installation.md).

# Installation

### Requisitos previos

* Servidor FiveM funcionando (QBox, QBCore, ESX o standalone — el framework es opcional).
* [`ox_lib`](https://overextended.dev/ox_lib) instalado y funcionando.
* [`oxmysql`](https://github.com/overextended/oxmysql) instalado y funcionando.

{% hint style="info" %}
Opcional: `ox_inventory`, para que el desarme al entrar sin permiso de armas funcione integrado con tu inventario.
{% endhint %}

### Paso 1 — Descargar

Descarga el `.zip` del resource desde tu compra de Tebex/BuiltByBit.

### Paso 2 — Ubicación correcta

```
resources/
└── yei-safezone/
    ├── fxmanifest.lua
    ├── config.lua
    ├── client/ (camera.lua, creator.lua, main.lua, panel.lua)
    ├── server/ (mysql_bridge.lua, main.lua)
    ├── locales/ (en.json, es.json)
    ├── web/ (index.html, assets/app.css, assets/app.js)
    └── sql/install.sql
```

### Paso 3 — Ensure en server.cfg (orden importante)

```cfg
ensure ox_lib
ensure oxmysql
ensure yei-safezone
```

{% hint style="warning" %}
`ox_lib` y `oxmysql` deben cargar **antes** que `yei-safezone` — son dependencias declaradas en el fxmanifest.
{% endhint %}

### Paso 4 — Base de datos

No necesitas correr ningún `.sql` manualmente. El bridge crea la tabla `yei_safezones` solo, reintentando hasta 15 veces si la base de datos aún no está lista. `sql/install.sql` queda como referencia opcional.

### Paso 5 — Permiso ACE (obligatorio)

```cfg
add_ace group.admin yei.safezone allow
add_principal identifier.license:TU_LICENCIA group.admin
```

O directo a una license:

```cfg
add_ace identifier.license:TU_LICENCIA yei.safezone allow
```

Este permiso se revisa en el comando **y** en cada acción del panel.

### Paso 6 — Configurar el script

Ajusta `config.lua`: permiso, comando, framework, TextUI, íconos, controles bloqueables, invencibilidad y Discord logging. Ver Configuration.

### Paso 7 — Reiniciar el servidor

Reinicia completamente `ox_lib`, `oxmysql` y `yei-safezone`.

### Errores comunes

| Problema                                     | Causa típica                          | Solución                                                              |
| -------------------------------------------- | ------------------------------------- | --------------------------------------------------------------------- |
| `ERROR CRÍTICO: la tabla 'Shared' no existe` | `config.lua` no cargó o está corrupto | Confirma que está en `shared_scripts` y empieza con `Yei = Yei or {}` |
| "Base de datos no lista todavía" repetido    | `oxmysql` no conecta                  | Revisa credenciales y el orden en `server.cfg`                        |
| El panel no abre                             | Falta el permiso ACE                  | Verifica `add_ace`/`add_principal`                                    |
| "Datos inválidos o puntos insuficientes"     | Menos de `MinPoints` marcados         | Marca al menos 4 puntos                                               |


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.yeistudios.com/scripts/safe-zone/installation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
