# Installation

Follow these steps in order to install the MOH Business System on your FiveM server.

## Requirements

* QBCore framework
* oxmysql (MySQL async library)
* A target resource: qb-target or ox\_target
* An inventory resource: qb-inventory, ox\_inventory, ps-inventory, codem-inventory, or origen\_inventory

{% stepper %}
{% step %}

### Add the Resource

Copy the resource folder into your server's `resources/` directory.

The folder name becomes the resource name automatically. All internal event names, NUI callbacks, and database references use this name — rename the folder once and everything updates with no code changes.

A recommended name is `moh-businesssystem`.
{% endstep %}

{% step %}

### Import the Database

Run the contents of `sql.sql` against your server's MySQL database. This creates four tables:

* **ammo\_stash\_passwords** — stores each player's stash password per store
* **ammo\_autosell\_status** — tracks whether a player has auto-sell active per store
* **ammo\_stash\_items** — holds the shared item pool for each store
* **ammo\_item\_prices** — stores custom sell prices set by each owner per store per item

You can run the SQL file through phpMyAdmin, HeidiSQL, or any MySQL client. If you are upgrading from v1.0, uncomment and run the ALTER TABLE lines at the bottom of the file to add the `store_id` column to existing tables.
{% endstep %}

{% step %}

### Configure the Resource

Open `config.lua` and set at minimum:

* **Config.Framework** — leave as `'qb-core'`
* **Config.InventoryResource** — set to `'auto'` or your inventory resource name
* **Config.TargetResource** — set to `'auto'` or your target resource name
* **Config.Stores** — define your stores (see the Stores Configuration page)
  {% endstep %}

{% step %}

### Add to server.cfg

Add the following line to your `server.cfg`, after your framework and inventory resources have started:

```bash
ensure moh-businesssystem
```

Replace `moh-businesssystem` with whatever folder name you used.
{% endstep %}

{% step %}

### Add Items to Your Items List

Every item listed in `Config.Stores[n].items` must exist in your QBCore items list (typically `qb-core/shared/items.lua` or your database items table, depending on your setup). Weapons use their standard GTA hash names such as `weapon_combatpistol`.
{% endstep %}
{% endstepper %}

## Verify the Installation

Start or restart your server and check the console for these log lines, which confirm the database loaded correctly:

```
[MOH Business System] Loaded N stash passwords
[MOH Business System] Loaded N auto-sell statuses
[MOH Business System] Loaded N custom item prices
```

Then travel in-game to the boss NPC coordinates you configured and confirm the target interaction appears.


---

# 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://mohssins.gitbook.io/mohscriptsdocs/moh-businesssystem/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.
