Installation
How to install and set up legacy-reports
Dependencies#
| Resource | Purpose |
|---|---|
| ox_lib | Callbacks, notifications, UI utilities |
| oxmysql | Database operations |
| legacy-lib | Framework abstraction (QBCore, ESX, etc.) |
All dependencies must be started before legacy-reports in your server.cfg.
Database Setup#
Run the following SQL in your database.
Warning: The schema contains
DROP TABLEstatements. If you have existing data, remove those lines before importing.
DROP TABLE IF EXISTS `legacy_report_messages`;
DROP TABLE IF EXISTS `legacy_reports`;
DROP TABLE IF EXISTS `legacy_report_types`;
DROP TABLE IF EXISTS `legacy_quick_replies`;
CREATE TABLE `legacy_report_types` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(100) NOT NULL,
`icon` VARCHAR(50) DEFAULT 'file-text',
`color` VARCHAR(20) DEFAULT '#4ADE80',
`active` TINYINT(1) DEFAULT 1,
`sort_order` INT DEFAULT 0,
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `legacy_reports` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`player_id` VARCHAR(60) NOT NULL,
`player_name` VARCHAR(100) NOT NULL,
`type_id` INT NOT NULL,
`title` VARCHAR(200) NOT NULL,
`description` TEXT NOT NULL,
`images` JSON DEFAULT ('[]'),
`priority` VARCHAR(20) DEFAULT 'low',
`status` VARCHAR(20) DEFAULT 'open',
`claimed_by` VARCHAR(60) DEFAULT NULL,
`claimed_by_name` VARCHAR(100) DEFAULT NULL,
`assigned_to` VARCHAR(60) DEFAULT NULL,
`assigned_to_name` VARCHAR(100) DEFAULT NULL,
`admin_notes` TEXT DEFAULT NULL,
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`closed_at` TIMESTAMP NULL DEFAULT NULL,
INDEX `idx_player_id` (`player_id`),
INDEX `idx_status` (`status`),
INDEX `idx_type_id` (`type_id`),
INDEX `idx_claimed_by` (`claimed_by`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `legacy_report_messages` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`report_id` INT NOT NULL,
`sender_id` VARCHAR(60) NOT NULL,
`sender_name` VARCHAR(100) NOT NULL,
`is_admin` TINYINT(1) DEFAULT 0,
`message` TEXT NOT NULL,
`images` JSON DEFAULT ('[]'),
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
INDEX `idx_report_id` (`report_id`),
FOREIGN KEY (`report_id`) REFERENCES `legacy_reports`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `legacy_quick_replies` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`title` VARCHAR(100) NOT NULL,
`message` TEXT NOT NULL,
`category` VARCHAR(50) DEFAULT 'general',
`created_by` VARCHAR(60) NOT NULL,
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO `legacy_report_types` (`name`, `icon`, `color`, `sort_order`) VALUES
('Player Report', 'user-x', '#EF4444', 1),
('Bug Report', 'bug', '#F97316', 2),
('Exploit Report', 'shield-alert', '#EAB308', 3),
('Staff Report', 'flag', '#8B5CF6', 4),
('Suggestion', 'lightbulb', '#3B82F6', 5);
INSERT INTO `legacy_quick_replies` (`title`, `message`, `category`, `created_by`) VALUES
('Investigating', 'Thank you for your report. We are currently investigating this matter.', 'general', 'system'),
('Need More Info', 'Could you please provide more details about this issue? Any additional information would be helpful.', 'general', 'system'),
('Resolved', 'This issue has been resolved. Thank you for bringing it to our attention!', 'closing', 'system'),
('Duplicate', 'This report appears to be a duplicate of an existing report. We will close this one.', 'closing', 'system'),
('Action Taken', 'Appropriate action has been taken regarding your report. Thank you for helping keep the server safe.', 'general', 'system');
The schema also seeds default report types and quick replies. On startup, the server will automatically seed these if the tables are empty (even without running the INSERT statements).
server.cfg#
ensure legacy-lib
ensure ox_lib
ensure oxmysql
ensure legacy-reports