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

# xakra\_weapons

## Requirements

* [oxmysql](https://github.com/overextended/oxmysql)
* [vorp\_core](https://github.com/VORPCORE/vorp-core-lua)
* [vorp\_inventory](https://github.com/VORPCORE/vorp_inventory-v2)
* [vorp\_menu](https://github.com/VORPCORE/vorp_menu)
* [vorp\_progressbar](https://github.com/VORPCORE/vorp_progressbar)
* [vorp\_inputs](https://github.com/VORPCORE/vorp_inputs-lua)

***

## Installation

1. Copy the script into any folder inside your server's `resources` directory.
2. Add the `ensure xakra_weapons` line to your server's `.cfg` configuration file.
3. Execute the SQL queries from `config/ammo.sql`. This file creates the default ammunition items required by the script and removes existing weapon customizations from previous weapon systems, if applicable.
4. Review the files inside the `config` folder and configure the available options to match your server, including weapon customization, crafting costs, ammunition settings, and other configurable options.

#### If you're using `vorp_inventory` v1

1. Go to the following GitHub file: [xakra\_weapons/framework/server.lua](https://github.com/XakraD/vorp_inventory-lua/blob/main/xakra_weapons-framework/server.lua)
2. Download the file and replace `framework/server.lua` in `xakra_weapons`. Alternatively, copy the contents of the GitHub file and replace the contents of `framework/server.lua` with it.
3. In `config/config.lua`, change the `MaxAmmo` option (line 53) to `SharedData.MaxAmmo`. This is also indicated in the comment on that line.

***

### Custom Inventory Integration

If you're using a custom inventory instead of **vorp\_inventory**, you'll need to adapt the inventory integration.

Open `framework/server.lua` and review the default implementation between **lines 110–133**. This section handles weapon detection when a player equips a weapon.

You have two options:

* Replace the default inventory handler with the equivalent event provided by your inventory system.
* Or trigger the following client event whenever a weapon is equipped:

```lua
TriggerClientEvent('xakra_weapons:UseWeapon', _source, Weapon, weaponStatus)
```

Example data:

```lua
local weaponStatus = {
    degradation = result[1].degradation,
    dirt = result[1].dirt,
    soot = result[1].soot,
    damage = result[1].damage
}

local Weapon = {
    id = data.id,
    hash = data.hash,
    name = result[1].name,
    label = result[1].custom_label,
    serial = result[1].serial_number,
    desc = result[1].custom_desc,
    comps = components,
}
```

This allows **xakra\_weapons** to correctly detect the equipped weapon and apply its saved condition and customization.

### Updates

The **Updates** section contains the functions you'll need to adapt for your inventory integration:

* **Condition:** Called when the weapon condition must be saved, such as when the player disconnects or unequips a weapon.
* **Comps:** Called when weapon customizations are applied through the customization menu. Depending on your inventory system, use either its exports/API or direct SQL queries to save and load the weapon components.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://xakra-scripts.gitbook.io/xakra-scripts-docs/redm-docs/xakra_weapons.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
