> For the complete documentation index, see [llms.txt](https://project-07.gitbook.io/project_07-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://project-07.gitbook.io/project_07-docs/scripts/project07-lootprop-v2/installation.md).

# Installation

## Dependencies

✅ **Supported Scripts**\
Scripts that are fully tested and officially supported.\
🟢 Compatible and ready to use without any additional changes.

❌ **Unsupported Scripts**\
Scripts that are not tested or officially supported.\
🔴 May require custom edits or additional development to work correctly.

⚠️ **Required Dependency**\
This script is required for this resource to work properly.\
Without this dependency installed, the script will not function.

<table data-search="false"><thead><tr><th align="center">Dependencies</th><th align="center">Support</th></tr></thead><tbody><tr><td align="center"><a href="https://github.com/Qbox-project/qbx_core">Qbox</a></td><td align="center">✅</td></tr><tr><td align="center"><a href="https://github.com/qbcore-framework/qb-core">QBCore</a></td><td align="center">✅</td></tr><tr><td align="center"><a href="https://github.com/overextended/ox_target">Ox Target</a></td><td align="center">✅</td></tr><tr><td align="center"><a href="https://github.com/qbcore-framework/qb-target">QB Target</a></td><td align="center">✅</td></tr><tr><td align="center"><a href="https://github.com/overextended/ox_inventory">Ox Inventory</a></td><td align="center">✅</td></tr><tr><td align="center"><a href="https://github.com/qbcore-framework/qb-inventory">QB Inventory</a></td><td align="center">✅</td></tr><tr><td align="center"><a href="https://github.com/overextended/ox_lib">Ox Lib</a></td><td align="center">⚠️</td></tr><tr><td align="center"><a href="https://github.com/Sleepless-Development/sleepless_lootbox">Sleepless Lootbox</a></td><td align="center">⚠️</td></tr></tbody></table>

***

## Installation

1. **Download** this resource and place it in your `resources` folder (e.g., `[Project07]/Project07_LootProps`).
2. **Ensure** `sleepless_lootbox` is installed and started before this resource.
3. **Edit** `config.lua` to define your props (see example below).
4. **Set** your Discord webhook URL (optional, but recommended).
5. **Add** to your server.cfg:

   ```cfg
   ensure sleepless_lootbox
   ensure Project07_LootProps
   ```
6. **Restart the server or start both resources.**

***

## Configuration

All settings are in config.lua.

**Basic Settings**

```lua

Config.Framework = 'auto'     -- 'auto', 'esx', 'qbcore', 'qbx'
Config.Target    = 'auto'     -- 'auto', 'ox_target', 'qb-target'
Config.Inventory = 'auto'     -- 'auto', 'ox_inventory', 'qb-inventory', 'qs-inventory'
Config.Debug     = false      -- set true to enable console logging
Config.ProgressTime = 5000    -- milliseconds
Config.ServerName = 'Lotus City'   -- shown in UI title and webhook footer
```

***

## Discord Webhook

<pre class="language-lua"><code class="lang-lua"><strong>
</strong>Config.Webhook = 'https://discord.com/api/webhooks/...'   -- leave empty to disable

</code></pre>

***

## Rarity Thresholds (auto‑calculated if not set on item)

```lua

Config.RarityThresholds = {
    common    = 17,    -- weight ≥ 17 → common
    uncommon  = 4,     -- weight ≥ 4  → uncommon
    rare      = 1,     -- weight ≥ 1  → rare
    epic      = 0.3,   -- weight ≥ 0.3 → epic
    -- below 0.3 → legendary
}

```

***

## Defining Props

**Each prop is a category with a unique identifier (e.g., 'dumpster').** **The identifier is used internally – the player never sees it.**

```lua

Config.Props = {
    ['dumpster'] = {
        model       = 'prop_dumpster_01a',   -- GTA model name
        label       = 'Dumpster',            -- shown in target menu & notifications
        icon        = 'fas fa-trash',        -- FontAwesome icon
        cooldown    = 120,                   -- seconds before prop resets (after maxAttempts used)
        maxAttempts = 3,                    -- how many searches before cooldown
        items = {
            { name = 'metalscrap', weight = 60, min = 1, max = 4, rarity = 'common' },   -- rarity optional
            { name = 'plastic',    weight = 70, min = 2, max = 6 },
            { name = 'lockpick',   weight = 10, min = 1, max = 2, rarity = 'rare' },
        }
    },
    -- add more props here...
}

```

***

## Item fields:

Field Description name - Item name – must match your inventory item name. label - Display name (optional – falls back to item name). weight - Relative drop weight (higher = more common). min / max - Amount range (single number if equal). rarity - Override auto‑calculated rarity (common, uncommon, rare, epic, legendary).

***

### Important:

* Weights do not need to sum to 100 – they are relative.
* Each prop’s loot table is registered as a temporary lootbox when a player searches it. The player never sees temporary IDs; the UI displays Config.ServerName as the title.

### 🎮 How it works

1. Player uses target system on a prop.
2. Progress bar plays (duration = Config.ProgressTime).
3. Server creates a temporary lootbox containing all items from the prop’s config (with pre‑rolled random amounts).
4. Sleepless UI opens, spins, and randomly selects one weighted item.
5. Item is automatically added to player’s inventory (sleepless handles the reward).
6. Discord webhook is sent (if configured).
7. Temporary lootbox is unregistered after UI closes.
8. Prop cooldown/attempts are updated.

***

## 🧪 Debugging

Set Config.Debug = true to see detailed server & client logs:

* Lootbox registration and unregistration
* Winner roll and webhook trigger
* Pending reward clearing
* Claim status

In-game command (debug mode only): /clearlootstates – resets all prop cooldowns and attempts.

Test webhook: /testwebhook – sends a test embed to your Discord channel.
