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

# 📦 Installation

🔧 Installation Guide

This section explains the complete setup process for **BrosDev-BountySystem**, including database setup, item configuration, and resource installation.

Follow each step carefully to ensure the script works correctly without errors.

***

### 📁 Step 1: Download & Extract

Download the resource from your official purchase source and extract it into your FiveM server resources folder.

Place it in a structured directory like this:

```
resources/
└── [brosdev]/
    └── BrosDev-BountySystem/
```

Inside the folder you should see:

```
BrosDev-BountySystem/
├── fxmanifest.lua
├── config.lua
├── client/
├── server/
├── html/
├── locales/
└── install/
```

***

### 🗄️ Step 2: Database Setup (SQL)

You must import the full SQL file into your database before starting the script.

📌 File location:

```
BrosDev-BountySystem/install/install.sql
```

#### ✅ Run this SQL in your database:

```sql
CREATE TABLE IF NOT EXISTS `brosdev_bounties` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `target_cid` VARCHAR(50) NOT NULL,
    `target_name` VARCHAR(100) NOT NULL,
    `amount` INT(11) NOT NULL,
    `total_paid` INT(11) NOT NULL,
    `anonymous` TINYINT(1) NOT NULL DEFAULT 0,
    `reason` VARCHAR(100) NOT NULL DEFAULT 'Unknown',
    `threat_level` VARCHAR(20) NOT NULL DEFAULT 'Civilian',
    `placed_by` VARCHAR(50) NOT NULL,
    `placed_name` VARCHAR(100) NOT NULL,
    `mugshot_url` VARCHAR(512) DEFAULT NULL,
    `mugshot_type` VARCHAR(20) DEFAULT 'none',
    `last_zone` VARCHAR(100) DEFAULT NULL,
    `last_coords` VARCHAR(100) DEFAULT NULL,
    `last_seen` BIGINT(20) DEFAULT NULL,
    `expires` BIGINT(20) NOT NULL,
    `created_at` BIGINT(20) NOT NULL,
    `status` VARCHAR(20) NOT NULL DEFAULT 'active',
    `claimed_by` VARCHAR(50) DEFAULT NULL,
    `claimed_name` VARCHAR(100) DEFAULT NULL,
    `claimed_at` BIGINT(20) DEFAULT NULL,
    `claimed_weapon` VARCHAR(100) DEFAULT NULL,
    `claimed_dist` FLOAT DEFAULT NULL,
    PRIMARY KEY (`id`),
    INDEX `idx_target_cid` (`target_cid`),
    INDEX `idx_placed_by` (`placed_by`),
    INDEX `idx_status` (`status`),
    INDEX `idx_expires` (`expires`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `brosdev_hunters` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `bounty_id` INT(11) NOT NULL,
    `hunter_cid` VARCHAR(50) NOT NULL,
    `hunter_name` VARCHAR(100) NOT NULL,
    `accepted_at` BIGINT(20) NOT NULL,
    `party_id` VARCHAR(50) DEFAULT NULL,
    PRIMARY KEY (`id`),
    INDEX `idx_bounty_id` (`bounty_id`),
    INDEX `idx_hunter_cid` (`hunter_cid`),
    UNIQUE KEY `unique_hunter_bounty` (`bounty_id`, `hunter_cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `brosdev_parties` (
    `id` VARCHAR(50) NOT NULL,
    `leader_cid` VARCHAR(50) NOT NULL,
    `bounty_id` INT(11) DEFAULT NULL,
    `created_at` BIGINT(20) NOT NULL,
    `disbanded_at` BIGINT(20) DEFAULT NULL,
    `status` VARCHAR(20) NOT NULL DEFAULT 'active',
    PRIMARY KEY (`id`),
    INDEX `idx_leader` (`leader_cid`),
    INDEX `idx_bounty` (`bounty_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `brosdev_party_members` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `party_id` VARCHAR(50) NOT NULL,
    `member_cid` VARCHAR(50) NOT NULL,
    `member_name` VARCHAR(100) NOT NULL,
    `joined_at` BIGINT(20) NOT NULL,
    PRIMARY KEY (`id`),
    INDEX `idx_party_id` (`party_id`),
    INDEX `idx_member_cid` (`member_cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `brosdev_leaderboard` (
    `cid` VARCHAR(50) NOT NULL,
    `player_name` VARCHAR(100) NOT NULL,
    `bounties_claimed` INT(11) NOT NULL DEFAULT 0,
    `bounties_placed` INT(11) NOT NULL DEFAULT 0,
    `total_earned` BIGINT(20) NOT NULL DEFAULT 0,
    `total_spent` BIGINT(20) NOT NULL DEFAULT 0,
    `last_claim_at` BIGINT(20) DEFAULT NULL,
    `monthly_earned` BIGINT(20) NOT NULL DEFAULT 0,
    `monthly_claimed` INT(11) NOT NULL DEFAULT 0,
    `last_reset` BIGINT(20) DEFAULT NULL,
    PRIMARY KEY (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `brosdev_witness_protection` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `cid` VARCHAR(50) NOT NULL,
    `player_name` VARCHAR(100) NOT NULL,
    `protected_by` VARCHAR(100) NOT NULL,
    `reason` VARCHAR(255) DEFAULT NULL,
    `granted_at` BIGINT(20) NOT NULL,
    `expires_at` BIGINT(20) DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `unique_cid` (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `brosdev_tracking_log` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `bounty_id` INT(11) NOT NULL,
    `buyer_cid` VARCHAR(50) NOT NULL,
    `purchased_at` BIGINT(20) NOT NULL,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `brosdev_economy_log` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `bounty_id` INT(11) DEFAULT NULL,
    `action` VARCHAR(50) NOT NULL,
    `from_cid` VARCHAR(50) DEFAULT NULL,
    `to_cid` VARCHAR(50) DEFAULT NULL,
    `amount` INT(11) NOT NULL,
    `note` VARCHAR(255) DEFAULT NULL,
    `timestamp` BIGINT(20) NOT NULL,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `brosdev_bounty_comments` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `bounty_id` INT(11) NOT NULL,
    `commenter_cid` VARCHAR(50) NOT NULL,
    `commenter_name` VARCHAR(100) NOT NULL,
    `comment` VARCHAR(200) NOT NULL,
    `created_at` BIGINT(20) NOT NULL,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `brosdev_tablet_wallet` (
    `cid` VARCHAR(50) NOT NULL,
    `player_name` VARCHAR(100) NOT NULL,
    `balance` BIGINT(20) NOT NULL DEFAULT 0,
    `total_deposited` BIGINT(20) NOT NULL DEFAULT 0,
    `total_withdrawn` BIGINT(20) NOT NULL DEFAULT 0,
    `total_earned` BIGINT(20) NOT NULL DEFAULT 0,
    `total_spent` BIGINT(20) NOT NULL DEFAULT 0,
    `last_updated` BIGINT(20) NOT NULL DEFAULT 0,
    PRIMARY KEY (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `brosdev_wallet_log` (
    `id` INT(11) NOT NULL AUTO_INCREMENT,
    `cid` VARCHAR(50) NOT NULL,
    `action` VARCHAR(30) NOT NULL,
    `amount` BIGINT(20) NOT NULL,
    `balance_after` BIGINT(20) NOT NULL,
    `note` VARCHAR(255) DEFAULT NULL,
    `timestamp` BIGINT(20) NOT NULL,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
```

***

### 🎒 Step 3: Item Setup (Bounty Tablet)

You must add the **bounty\_tablet item** into your inventory system manually.

***

#### 📦 ox\_inventory (Recommended)

File:

```
ox_inventory/data/items.lua
```

```lua
['bounty_tablet'] = {
    label = 'Bounty Tablet',
    weight = 1000,
    stack = false,
    close = true,
    description = 'A dark web tablet used to access the bounty network.',
    client = {
        export = 'BrosDev-BountySystem.useTablet'
    }
}
```

***

#### 📦 qb-inventory

File:

```
qb-core/shared/items.lua
```

```lua
['bounty_tablet'] = {
    name = 'bounty_tablet',
    label = 'Bounty Tablet',
    weight = 1000,
    type = 'item',
    image = 'bounty_tablet.png',
    unique = true,
    useable = true,
    shouldClose = true,
    description = 'A dark web tablet used to access the bounty network.'
}
```

***

#### 📦 qs-inventory

File:

```
qs-inventory/config/items.lua
```

```lua
['bounty_tablet'] = {
    name = 'bounty_tablet',
    label = 'Bounty Tablet',
    weight = 1000,
    type = 'item',
    image = 'bounty_tablet.png',
    unique = true,
    useable = true,
    shouldClose = true,
    description = 'A dark web tablet used to access the bounty network.'
}
```

***

#### 📦 ESX Default

File:

```
es_extended/config/items.lua
```

```lua
['bounty_tablet'] = {
    label = 'Bounty Tablet',
    weight = 1000,
    rare = false,
    canRemove = true
}
```

***

### 🚀 Step 4: Server Configuration

Add the resource in your `server.cfg`:

```
ensure oxmysql
ensure ox_lib
ensure BrosDev-BountySystem
```

Make sure **oxmysql and ox\_lib start BEFORE the script**.

***

### 🔄 Step 5: Start Resource

Restart your server or run:

```
restart BrosDev-BountySystem
```

***

### ✅ Installation Complete

If everything is done correctly:

* Database tables will be created
* Tablet item will work in inventory
* UI will open using `bounty_tablet`
* Bounty system will fully function in-game

***
