# Installation

### Prerequisites

Before installing Sergei's Warehouse, ensure you have the following dependencies installed and configured on your FiveM server:

**⚠️ Required Dependencies:**

* **QBCore Framework** - Core framework for player management
* **oxmysql** - Database integration (or qb-mysql)
* **ox\_target** - Target system (optional, qb-target also supported)
* **ox\_inventory** - Inventory system (optional, qb-inventory also supported)

**📌 Note:** The script is designed to work with QBCore as the primary framework. While it supports different target and inventory systems, QBCore is required for player management and data handling.

### Installation Steps

1. &#x20;**Download the Resource**\
   Download the Sergei's Warehouse resource and place it in your server's resources folder. The folder should be named `sergeis-warehouse` or similar.
2. &#x20;**Import the Database**\
   Import the SQL file from `sql/warehouse.sql` into your MySQL database. This will create the necessary tables for warehouse storage and sharing functionality.
3. &#x20;**Add to Server Configuration**\
   Add `ensure sergeis-warehouse` to your server.cfg file. Place it after your QBCore and database resources to ensure proper loading order.
4. &#x20;**Restart Your Server**\
   Restart your FiveM server to load the new resource. Check the server console for any error messages during startup.

### Database Setup

The script requires several database tables to function properly. The SQL file will create the following tables:

#### 📊 Database Tables

* **warehouses** - Stores warehouse ownership and purchased slot count
* **warehouse\_storage** - Stores items in each storage slot
* **warehouse\_sharing** - Manages sharing relationships between players
* **warehouse\_access\_log** - Optional logging for warehouse access (if enabled)

\-- Example of importing the database

&#x20;\-- Run this command in your MySQL client or HeidiSQL SOURCE /path/to/sergeis-warehouse/sql/warehouse.sql;

**💡 Tip:** Make sure to backup your database before importing the SQL file, especially if you're updating from a previous version.

### Configuration

After installation, you'll need to configure the script to match your server's setup and preferences.

#### ⚙️ Basic Configuration

Edit the `config.lua` file to customize:

* Warehouse pricing and slot costs
* Sales ped and entrance locations
* Target system preferences
* Inventory system settings
* Sharing system options

```
-- Example configuration 
Config.TargetSystem = 'ox_target' -- or 'qb-target'
Config.InventorySystem = 'ox_inventory' -- or 'qb-inventory'
Config.Warehouse.price = 150000 -- Base warehouse price
```

### Verification

After installation, verify that everything is working correctly:

1. &#x20;**Check Console**\
   Look for any error messages in the server console during startup. The script should load without errors.
2. &#x20;**Test In-Game**\
   Join your server and test the basic functionality:

* Visit the sales ped location
* Try to purchase a warehouse
* Access the warehouse interior
* Test storage functionality

3. &#x20;**Check Database**\
   Verify that the database tables were created correctly and that data is being stored properly.

### Troubleshooting Installation

If you encounter issues during installation, check the following:

**❌ Common Issues:**

* **Resource not starting:** Check that all dependencies are installed and running
* **Database errors:** Ensure MySQL is running and the database connection is correct
* **QBCore errors:** Verify QBCore is properly installed and configured
* **Target system errors:** Check that your chosen target system is installed

**🔧 Debug Mode:** Enable debug mode in `config.lua` by setting `Config.Debug = true` to see detailed logging information.

Once installation is complete, you can:

* Customize the configuration to match your server's economy
* Set up custom locations for sales ped and warehouse entrance
* Configure sharing system settings
* Test the sharing functionality with multiple players
* Monitor server performance and adjust settings as needed

**📚 Next Steps:** After installation, read the Configuration and Usage Guide sections to learn how to customize and use the warehouse system effectively.


---

# 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://sergeis-scripts.gitbook.io/sergeis-scripts-docs/sergeis-warehouse/installation.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.
