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

# Instalación

Instala Cuxial Servicios Comunitarios paso a paso: dependencias, SQL, permisos de staff y orden de arranque.

Cuxial Servicios Comunitarios necesita una tabla SQL y ningún ítem de inventario. No tiene convars.

{% stepper %}
{% step %}

## Comprueba las dependencias

Deben estar instaladas y funcionando antes de añadir el script:

* `ox_lib`
* `oxmysql`
* `cuxial_bridge`, sobre QBox o QBCore
* `bl_sprites`
* OneSync activado en el servidor

Dos integraciones son opcionales y se detectan solas:

* `cuxial_chat`: las sanciones se anuncian en su canal de sanciones. Sin él se anuncian en el chat estándar.
* `wais-hudv6`: el radar se muestra mientras el jugador está dentro de la zona de comunitarias.
  {% endstep %}

{% step %}

## Copia el recurso

Coloca la carpeta `cuxial_cmservices` dentro de tu directorio `resources`.

{% hint style="danger" %}
Mantén el nombre de la carpeta exactamente como `cuxial_cmservices`. El recurso se detiene solo si arranca con otro nombre.
{% endhint %}
{% endstep %}

{% step %}

## Importa el SQL

Ejecuta `cuxial_cmservices.sql`, incluido en el recurso, en tu base de datos.

{% tabs %}
{% tab title="Instalación nueva" %}
{% code title="cuxial\_cmservices.sql" %}

```sql
CREATE TABLE IF NOT EXISTS `cuxial_cmservices` (
  `citizenid` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
  `comserv` text,
  `jail` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
```

{% endcode %}
{% endtab %}

{% tab title="Tabla punishments existente" %}
Si tu base de datos ya tiene una tabla `punishments` con estas tres columnas y quieres conservar sus registros, renómbrala en lugar de crear una nueva:

```sql
RENAME TABLE `punishments` TO `cuxial_cmservices`;
```

{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

## Da el permiso a tu staff

Los comandos están restringidos al grupo ACE `group.mod`, y el servidor comprueba además el permiso `mod` de tu framework.

{% code title="server.cfg" %}

```cfg
# Los moderadores tienen el permiso "mod"
add_ace group.mod mod allow

# Los administradores heredan lo que pueden hacer los moderadores
add_principal group.admin group.mod

# Una línea por miembro del staff
add_principal identifier.license:xxxxxxxxxxxxxxxx group.mod
```

{% endcode %}

Si tu servidor ya define estos grupos, añade solo los miembros del staff que falten. Consulta [Comandos y permisos](/scripts/es/nucleo/cuxial-cmservices/commands.md).
{% endstep %}

{% step %}

## Ajusta las zonas

Abre `config/shared.lua` y revisa la zona de comunitarias, las celdas de la cárcel y los puntos de salida. Los valores entregados son una ubicación de ejemplo.

Pon `polyZone.debug = false` antes de abrir el servidor a los jugadores. Con `true` las paredes de la zona se dibujan en el mundo, lo que ayuda mientras ajustas el polígono.

Cada opción está explicada en [Configuración](/scripts/es/nucleo/cuxial-cmservices/configuration.md).
{% endstep %}

{% step %}

## Inicia el recurso

Inícialo después de sus dependencias y de tu framework:

{% code title="server.cfg" %}

```cfg
ensure ox_lib
ensure oxmysql
# tu framework aquí (qbx_core o qb-core)
ensure cuxial_bridge
ensure bl_sprites
# opcional
ensure cuxial_chat
ensure cuxial_cmservices
```

{% endcode %}
{% endstep %}

{% step %}

## Comprueba que funciona

1. Entra con una cuenta de staff y ejecuta `/sanciones`. Se abre el panel.
2. Ejecuta `/comserv` con tu propio id, `2` tareas y un motivo. Eres llevado a la zona y la primera tarea aparece en el mapa.
3. Ve al punto de interacción y pulsa <kbd>E</kbd>. Corre la barra de progreso y baja el contador.
4. Termina la segunda tarea. Eres llevado al punto de salida.
5. Ejecuta `/jaila` con tu propio id, `1` minuto y un motivo de una palabra. Eres llevado a una celda y quedas libre un minuto después.
   {% endstep %}
   {% endstepper %}

Siguiente: mueve las zonas y escribe tus propias tareas en [Configuración](/scripts/es/nucleo/cuxial-cmservices/configuration.md).


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.cuxial.com/scripts/es/nucleo/cuxial-cmservices/installation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
