Inicio › Documentación › Instalación · origen_reports

Instalación · origen_reports

1. Base de datos

El recurso incluye un migrador automático. En cada arranque lee database.sql de la raíz del recurso, crea las tablas que falten y añade o actualiza las columnas que falten, por lo que no hace falta importar SQL manualmente.

Si prefieres crear el esquema a mano, ejecuta el siguiente SQL antes de arrancar el recurso:

sql
CREATE TABLE `origen_reports_tickets` (
    `id`                   INT UNSIGNED   NOT NULL AUTO_INCREMENT,
    `reporter_identifier`  VARCHAR(100)   NOT NULL,
    `reporter_name`        VARCHAR(100)   NOT NULL,
    `identifiers`          LONGTEXT       NOT NULL,
    `type`                 VARCHAR(100)   NOT NULL,
    `description`          TEXT           NOT NULL,
    `status`               ENUM('pending','claimed','resolved') NOT NULL DEFAULT 'pending',
    `assigned_name`        VARCHAR(100)   DEFAULT NULL,
    `assigned_identifier`  VARCHAR(100)   DEFAULT NULL,
    `created_at`           TIMESTAMP      NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at`           TIMESTAMP      NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    INDEX `idx_reporter` (`reporter_identifier`),
    INDEX `idx_status`   (`status`),
    INDEX `idx_assigned_identifier` (`assigned_identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
 
CREATE TABLE `origen_reports_messages` (
    `id`        INT UNSIGNED NOT NULL AUTO_INCREMENT,
    `report_id` INT UNSIGNED NOT NULL,
    `sender`    VARCHAR(100) NOT NULL,
    `text`      TEXT         NOT NULL,
    `is_staff`  TINYINT(1)   NOT NULL DEFAULT 0,
    `created_at` TIMESTAMP   NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    INDEX `idx_report` (`report_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
 
CREATE TABLE `origen_reports_types` (
    `id`         INT UNSIGNED NOT NULL AUTO_INCREMENT,
    `label`      VARCHAR(100) NOT NULL,
    `icon`       VARCHAR(50)  NOT NULL DEFAULT 'help',
    `sort_order` INT          NOT NULL DEFAULT 0,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
 
CREATE TABLE `origen_reports_teleports` (
    `id`     INT UNSIGNED NOT NULL AUTO_INCREMENT,
    `name`   VARCHAR(100) NOT NULL,
    `coords` LONGTEXT     NOT NULL,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
 
CREATE TABLE `origen_reports_config` (
    `key`   VARCHAR(100) NOT NULL,
    `value` LONGTEXT     NOT NULL,
    PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
 
CREATE TABLE `origen_reports_groups` (
    `id`              INT UNSIGNED NOT NULL AUTO_INCREMENT,
    `name`            VARCHAR(50)  NOT NULL,
    `permissions`     LONGTEXT     NOT NULL,
    `allow_all_items` TINYINT(1)   NOT NULL DEFAULT 1,
    `allowed_items`   LONGTEXT     DEFAULT NULL,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
 
CREATE TABLE `origen_reports_staff` (
    `identifier`         VARCHAR(100)  NOT NULL,
    `name`               VARCHAR(100)  NOT NULL,
    `group_id`           INT UNSIGNED  DEFAULT NULL,
    `total_resolved`     INT UNSIGNED  NOT NULL DEFAULT 0,
    `total_duty_seconds` INT UNSIGNED  NOT NULL DEFAULT 0,
    `last_seen`          TIMESTAMP     NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`identifier`),
    CONSTRAINT `fk_staff_group` FOREIGN KEY (`group_id`) REFERENCES `origen_reports_groups` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

origen_reports_groups debe existir antes que origen_reports_staff por la clave foránea fk_staff_group. Mantén el orden anterior si importas el fichero a mano.


2. server.cfg

Añade el recurso después de sus dependencias:

cfg
ensure ox_lib
ensure oxmysql
ensure screenshot-basic # optional, only for the screenshot quick action
ensure origen_reports

Los recursos de framework, inventario, ropa y ambulancia también deben arrancar antes que origen_reports para que la detección automática los encuentre.


3. Acceso del staff

Un jugador pasa a ser staff mediante uno de tres niveles de acceso:

Nivel Cómo se concede Permisos
Completo Cualquier permiso incluido en Config.StaffFullAccess Todas las acciones rápidas y todo el panel de administración
Limitado Se añade como staff desde el panel de administración con un grupo asignado Exactamente los permisos de ese grupo
Básico Cualquier permiso incluido en Config.StaffBasicAccess Conjunto básico por defecto (ver abajo)

Cada entrada de Config.StaffFullAccess / Config.StaffBasicAccess se comprueba, por orden, con:

  1. El ACE <permission> o group.<permission>.
  2. qbx_core — HasPermission / GetPermission.
  3. qb-core — Functions.GetPermission.
  4. es_extended — xPlayer.getGroup() debe ser igual al permiso.

Para configuraciones basadas en ACE, concede los grupos en tu server.cfg:

cfg
add_principal identifier.license:xxxxxxxxxxxxxxxx group.admin
add_principal identifier.license:yyyyyyyyyyyyyyyy group.mod

Permisos por defecto del nivel básico:

Permiso Concedido
teleport Sí
inventory Sí
revive Sí
ropa Sí
bucket Sí
screenshot Sí
spectate Sí
giveitems No
video No

La pantalla compartida en directo (video) nunca se concede por defecto al staff básico. Crea un grupo en el panel de administración con ese permiso activado y asígnalo a los miembros del staff que lo necesiten.


4. Webhooks de Discord (opcional)

Todos los webhooks están en svconfig.lua. Sustituye YOUR_WEBHOOK_URL por las URL de tus webhooks de Discord, o pon enabled = false para desactivar por completo el registro de logs.

lua
return {
    enabled = true,
    webhooks = {
        ['report-created']  = 'https://discord.com/api/webhooks/...',
        ['report-claimed']  = 'https://discord.com/api/webhooks/...',
        -- ...
        ['screenshot-upload'] = 'https://discord.com/api/webhooks/...',
    }
}

screenshot-upload no es un canal de logs: es el webhook al que screenshot-basic sube la captura. La acción rápida de captura de pantalla no hace nada mientras esté vacío o siga con el valor YOUR_WEBHOOK_URL.

Consulta Configuración para ver la lista completa de claves de webhook.


5. Idioma

Define el idioma del recurso en config.lua. Los ficheros de traducción están en locales/.

lua
Config.Language = 'en' -- 'es' | 'en'