OrigenNetwork
Docs

Installation · origen_reports

1. Database

The resource ships with an auto-migrator. On every start it reads database.sql from the resource root, creates any missing table and adds or updates missing columns, so no manual SQL import is required.

If you prefer to create the schema manually, run the following SQL before starting the resource:

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 must exist before origen_reports_staff because of the fk_staff_group foreign key. Keep the order above if you import the file by hand.


2. server.cfg

Add the resource after its dependencies:

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

The framework, inventory, clothing and ambulance resources must also be started before origen_reports so the auto-detection finds them.


3. Staff access

A player becomes staff through one of three access levels:

LevelHow it is grantedPermissions
FullAny permission listed in Config.StaffFullAccessEvery quick action and the whole admin panel
LimitedAdded as staff from the admin panel with a group assignedExactly the permissions of that group
BasicAny permission listed in Config.StaffBasicAccessDefault basic set (see below)

Each entry of Config.StaffFullAccess / Config.StaffBasicAccess is checked, in order, against:

  1. The ACE <permission> or group.<permission>.
  2. qbx_core — HasPermission / GetPermission.
  3. qb-core — Functions.GetPermission.
  4. es_extended — xPlayer.getGroup() must equal the permission.

For ACE-based setups, grant the groups in your server.cfg:

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

Default permissions of the basic level:

PermissionGranted
teleportYes
inventoryYes
reviveYes
ropaYes
bucketYes
screenshotYes
spectateYes
giveitemsNo
videoNo

Live screen sharing (video) is never granted by default to basic staff. Create a group in the admin panel with that permission enabled and assign it to the staff members who need it.


4. Discord webhooks (optional)

All webhooks live in svconfig.lua. Replace YOUR_WEBHOOK_URL with your Discord webhook URLs, or set enabled = false to disable logging entirely.

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 is not a log channel: it is the webhook screenshot-basic uploads the capture to. The screenshot quick action does nothing while it is empty or still set to YOUR_WEBHOOK_URL.

See Configuration for the full list of webhook keys.


5. Language

Set the resource language in config.lua. Translation files live in locales/.

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