# Weapon Rack

### ⚡ Getting Started

**Be sure to read the README file for complete setup instructions!**

***

### ➕ Creating a Weapon Rack

You can create a weapon rack using any of these methods :

1. **With an Inventory Item**
   * Use the item `"weaponrack"` or any other defined in `Config.WeaponRack`.
2. **Client-side Event**

   ```lua
   TriggerEvent("bt_rack:startPlaceObject")
   ```
3. **Server-side Event**

   ```lua
   TriggerClientEvent("bt_rack:startPlaceObject", source)
   ```
4. **Via Inventory Integration (Example with VORP):**

   ```lua
   local VORPInv = exports.vorp_inventory:vorp_inventoryApi()
   VORPInv.RegisterUsableItem("weaponrack", function(data)
       TriggerClientEvent("bt_rack:startPlaceObject", data.source)
       VORPInv.CloseInv(data.source)
   end)
   ```

***

### ⚙️ Configuration Example (`config.lua`)

```lua
Config = {}
Config.DEBUG = false -- Open rack creator UI automatically

-- Inventory item to trigger rack placement (leave empty to disable)
Config.WeaponRack = "weaponrack"

-- Key configuration for rack placement/management
Config.OpenMarket      = keys["U"]
Config.CraftObject     = keys["U"]
Config.ChangeDistance  = keys["DOWN"]
Config.RotateLeft      = keys["LEFT"]
Config.RotateRight     = keys["RIGHT"]
Config.Cancel          = keys["R"]

-- Restrictions and admin management
Config.WhitelistJobs       = {}    -- Only these jobs can manage racks (empty = everyone)
Config.BlacklistJobs       = {}    -- These jobs are forbidden
Config.WeaponList          = { ... } -- Whitelist of weapons (labels must match your language/game)
Config.AdminRole           = { "mod", "admin", "superadmin" }
Config.OnlyStaffCanDeleteStalls = false
Config.SpamSeconds         = 1

-- Discord staff webhook (optional)
Config.DiscordWebhook = ""
Config.DiscordName = "BT_WEAPONRACK"

-- UI Language (supports: fr, en, es, pt, de, it)
Config.NUILangage = "en"

Config.Txt = {
    -- ... (see file for all UI text)
}

-- UI Notification function (server side)
function SendNotification(source, type, message)
    TriggerClientEvent("bt_rack:showNotification", source, type, message)
end
```

***

### 📌 Notes

* **Flexible creation:** Weapon racks can be placed via inventory, events, or server triggers.
* **Fully configurable:** Manage who can place or delete racks, which weapons are accepted, and customize all UI messages.
* **Discord logs:** Optional webhook for staff actions or moderation.
* **Multilingual:** Interface and prompts support multiple languages (see `Config.NUILangage`).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://botiv.gitbook.io/rdr2/weapon-rack.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
