# Stash

***

### Overview

**X8-Stash** is a complete vault management system for FiveM servers running QBCore or Qbox. It allows authorized players (typically high-ranking police officers or admins) to create, manage, edit, and delete personal or shared vaults anywhere on the map.

The script supports both **static vaults** (placed by admin/police at fixed coordinates) and **portable safes** (item-based personal stashes that players can drop and pick up). Every vault has its own access mode, slot count, weight limit, and protection layer.

***

### Key Features

#### Multi-Framework Support

* Native compatibility with **QBCore** and **Qbox**
* Auto-detects the running framework with manual override option

#### Multi-Inventory Support

* **ox\_inventory**
* **qb-inventory**
* Auto-detection or forced selection through config

#### Multi-Target Support

* **ox\_target**
* **qb-target**
* **interact**
* Unified interaction system regardless of which target resource is active

#### Six Access Modes

Each vault can be locked behind one of these protection types:

* **Password** — secret numeric/alphanumeric code
* **Job** — restricted to specific job(s) and minimum grade
* **Gang** — restricted to specific gang(s) and minimum grade
* **Password + Job** — combined authentication
* **Password + Gang** — combined authentication
* **Personal** — bound to a single player's CitizenID

#### Two Vault Types

* **Static Vaults** — created with coordinates only or attached to a 3D object (safe, locker, gun cabinet, etc.)
* **Portable Safes** — given as an inventory item, can be placed and retrieved anywhere

#### Full Management Panel

Authorized players get an in-game UI to:

* Search through all vaults
* Teleport to any vault
* Set GPS waypoint
* Edit any vault's settings
* Move a vault to a new location (current position or gizmo)
* Delete vaults
* Restore portable safe items back to their owner

#### Discord Logging

Built-in webhook integration logs:

* Vault creation
* Vault opening attempts
* Failed authentication
* Vault deletion and edits

#### Bilingual Interface

Includes full **English** and **Arabic** locale files. Easily extendable for additional languages.

***

### How It Works

1. An authorized player (police officer, grade 2+ by default) runs the create command
2. They choose access mode, slot count, weight, and either coordinates or a 3D object
3. The vault is saved to the database with its protection settings
4. Other players interact with the vault using the configured target system
5. Access is verified server-side based on the vault's mode (password, job, gang, etc.)
6. Once authorized, the stash opens through the active inventory resource

***

### Requirements

| Resource                                       | Required    | Notes                                  |
| ---------------------------------------------- | ----------- | -------------------------------------- |
| **qb-core** or **qbx\_core**                   | ✓           | One framework must be running          |
| **ox\_inventory** or **qb-inventory**          | ✓           | One inventory must be running          |
| **ox\_target**, **qb-target**, or **interact** | ✓           | One target system must be running      |
| **ox\_lib**                                    | Recommended | Used for menus, dialogs, notifications |
| **MySQL** (oxmysql)                            | ✓           | For vault persistence                  |

***

### Default Commands

| Command        | Permission      | Description                      |
| -------------- | --------------- | -------------------------------- |
| `/createvault` | police grade 2+ | Open the vault creation menu     |
| `/managevault` | police grade 2+ | Open the management panel        |
| `/givevault`   | admin           | Give a portable safe to a player |

> All commands and permissions are configurable in `Config.lua`.

***

### Installation Quick Start

1. Download the resource and drop it into your `resources` folder
2. Add `ensure x8-stash` to your `server.cfg`
3. Add the `portable_safe` item to your inventory (see Item Setup page)
4. Configure your preferences in `Config.lua`
5. Restart the server — the script will auto-detect your framework, inventory, and target

***

### Documentation Structure

This documentation is split into three reference pages:

* **Bridge System** — Internal abstraction layer that handles framework, inventory, and target compatibility
* **Configuration** — Every option in `Config.lua` explained
* **Item Setup** — How to register the `portable_safe` item in your inventory

***

### Support

For bugs, feature requests, or framework compatibility issues, contact the developer on Discord or open a ticket in the support server.


---

# 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://x8project.gitbook.io/x8project/projects/stash.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.
