# Installation

Ensure you have the following resources installed on your server:

* **oxmysql:** For all database operations.
* **ESX or QBCore:** Your server's core framework. Must be configured in `config.lua`.
* **(Optional) screenshot-basic:** Required if you enable webhook screenshots.
* **(Optional) ox\_target or qb-target:** Required if you set the interaction method to use them in `config.lua`.

#### 2. Download & Placement 📦

1. Download the `mic_shopcreator` script.
2. Place the `mic_shopcreator` folder inside your server's `resources` directory.

#### 3. Database Setup 💾

Execute the `mic_shopcreator.sql` file on your server's database. This will create all the necessary tables for shops, locations, products, and more.

The tables created are:

* `mic_shopcreator`
* `mic_shopcreator_locations`
* `mic_shopcreator_owners`
* `mic_shopcreator_products`
* `mic_shopcreator_jobs`
* `mic_shopcreator_rewards`
* `mic_shopcreator_employees`
* `mic_shopcreator_owner_products`
* `mic_shopcreator_vaults`

#### 4. Server Configuration ⚙️

1. Open your `server.cfg` file.
2. Add the following line to ensure the resource starts with the server:

   ```cfg
   ensure mic_shopcreator
   ```
3. **Grant Permissions:** To allow players or administrators to use the creator menu, you must grant them ACE permissions. Add one of the following lines to your `server.cfg`.

   **To grant permission to a specific player (recommended):**

   ```cfg
   # Replace 'your_discord_id' with the actual Discord ID of the user.
   add_ace identifier.discord:your_discord_id mic_shop.open allow
   ```

   **To grant permission to an entire group (e.g., admin):**

   ```cfg
   add_ace group.admin mic_shop.open allow
   ```

#### 5. Script Initialization ✅

No special exports or events are required to start the script. The system is initialized by using the command defined in the configuration (`/shopcreator` by default), which opens the main creation menu.
