> 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_carts.md).

# xakra\_carts

## Requirements

* [oxmysql](https://github.com/overextended/oxmysql)
* [vorp\_menu](https://github.com/VORPCORE/vorp_menu)
* [vorp\_core](https://github.com/VORPCORE/vorp-core-lua)
* [vorp\_inventory](https://github.com/VORPCORE/vorp_inventory-v2)
* vorp\_stables | syn\_stables | xakra\_stables | gum\_stables | SS-Stable

***

## Installation

1. Copy the script into any folder inside your server's `resources` directory.
2. Add the `ensure xakra_carts` line to your server's `.cfg` configuration file.
3. If your stable script is included in the list of supported integrations, execute the SQL queries from the `columns.sql` file located in the script's root directory. This will create the required `health` and `loadouts` columns.
4. Open `config.lua` and select your stable script using `Config.SQL`.
5. Set `Config.RadiusApplyMods` to the same cart spawn radius used by your stable script. This ensures that saved modifications are applied correctly whenever a cart is spawned.
6. Review the files inside the config folder and configure the available options to match your server, including customization costs, crafting costs, and other settings.

***

### Adapting to a Custom Stable Script

If your stable script is not included in the list of supported integrations, you can easily adapt it.

First, determine how your stable script spawns carts:

* Key-based spawning: Configure the corresponding key in Config.Keys.Call.
* Database or internal spawning: Set Config.Keys.Call to false. In this case, your stable script must notify xakra\_carts when a cart becomes active.

#### Detecting the Active Cart

After spawning or activating a cart, notify **xakra\_carts** using the following event:

**Client-side**

```lua
TriggerServerEvent('xakra_carts:ActiveCartId', false, cartId)
```

**Server-side**

```lua
TriggerEvent('xakra_carts:ActiveCartId', source, cartId)
```

* `source` should be the player's server ID when calling the event from the server.
* Use `false` when calling it from the client.

This allows **xakra\_carts** to detect the active cart and load its saved data, including health, loadouts and other persistent information.

#### Updating the Cart Entity

If your stable script repairs destroyed carts by replacing the entity with a new one, notify **xakra\_carts** after creating the new entity:

```lua
TriggerEvent('xakra_carts:EntityUpdated', entity)
```

This updates the internal entity reference so all prompts, interactions and systems continue working with the new cart.


---

# 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_carts.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.
