> For the complete documentation index, see [llms.txt](https://izaap-studios.gitbook.io/izaap-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://izaap-studios.gitbook.io/izaap-scripts/reports/installation-and-configuration.md).

# Installation & Configuration

### Downloading Dependencies

{% stepper %}
{% step %}

### **Oxmysql**

{% embed url="<https://github.com/overextended/oxmysql>" %}
{% endstep %}

{% step %}

### Screenshot Basic

Required for player/staff pictures and screenshots used by the report system.

{% embed url="<https://github.com/citizenfx/screenshot-basic>" %}
{% endstep %}
{% endstepper %}

If you use `ox_lib` notifications, make sure `ox_lib` starts before the script:

```shellscript
ensure ox_lib
ensure oxmysql
ensure screenshot-basic
ensure izaap_reports
```

***

**SQL**

Import the included SQL file into your database:

```sql
CREATE TABLE IF NOT EXISTS `izaap_reports` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `identifier` VARCHAR(80) NOT NULL,
  `player_name` VARCHAR(80) NOT NULL,
  `category` VARCHAR(40) NOT NULL,
  `description` TEXT NOT NULL,
  `status` ENUM('pending','claimed','closed') NOT NULL DEFAULT 'pending',
  `claimed_by_identifier` VARCHAR(80) NULL DEFAULT NULL,
  `claimed_by_name` VARCHAR(80) NULL DEFAULT NULL,
  `closed_by_identifier` VARCHAR(80) NULL DEFAULT NULL,
  `closed_by_name` VARCHAR(80) NULL DEFAULT NULL,
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `claimed_at` TIMESTAMP NULL DEFAULT NULL,
  `closed_at` TIMESTAMP NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  INDEX `idx_identifier` (`identifier`),
  INDEX `idx_status` (`status`),
  INDEX `idx_claimed` (`claimed_by_identifier`),
  INDEX `idx_created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `izaap_report_messages` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `report_id` INT NOT NULL,
  `sender_identifier` VARCHAR(80) NOT NULL,
  `sender_name` VARCHAR(80) NOT NULL,
  `sender_type` ENUM('player','staff','system') NOT NULL DEFAULT 'player',
  `message` TEXT NOT NULL,
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  INDEX `idx_report_id` (`report_id`),
  INDEX `idx_sender_identifier` (`sender_identifier`),
  INDEX `idx_created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `izaap_report_staff_stats` (
  `identifier` VARCHAR(80) NOT NULL,
  `staff_name` VARCHAR(80) NOT NULL,
  `discord_id` VARCHAR(32) NULL DEFAULT NULL,
  `reports_claimed` INT NOT NULL DEFAULT 0,
  `reports_closed` INT NOT NULL DEFAULT 0,
  `messages_sent` INT NOT NULL DEFAULT 0,
  `last_seen` TIMESTAMP NULL DEFAULT NULL,
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`identifier`),
  INDEX `idx_reports_claimed` (`reports_claimed`),
  INDEX `idx_reports_closed` (`reports_closed`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
```

***

**Permissions**

Staff permissions are configured from `config.lua`.

```lua
Config.AdminGroups = {
    'god',
    'admin',
    'superadmin'
}

Config.AcePermission = 'izaap_reports.admin'
```

Optional ACE permission:

```shellscript
add_ace group.admin izaap_reports.admin allow
add_principal identifier.license:YOUR_LICENSE_HERE group.admin
```

***

**Configuration**

Open `config.lua` and configure the script:

```lua
Config.Framework = 'auto' -- 'auto', 'qb', 'qbx', 'esx', 'standalone'
Config.Lang = 'en' -- 'en' or 'es'

Config.Command = 'reports'
Config.OpenKey = 'F7'

Config.NotifyType = 'default' -- 'default', 'ox', false
```

***

**Discord Avatar / Photos**

If you want Discord profile pictures, add your bot token in `config.lua`:

```lua
Config.DiscordAvatar = {
    enabled = true,
    botToken = 'YOUR_DISCORD_BOT_TOKEN',
    cacheMinutes = 60
}
```

`screenshot-basic` must be started if your version uses player photos/screenshots.

***

* Import the SQL.
* Start `oxmysql` before `izaap_reports`.
* Start `screenshot-basic` before `izaap_reports`.
* Configure staff permissions.
* Configure your framework in `config.lua`.
* Use `/reports` or `F7` to open the panel.

***
