# Shop Creator

### Introduction

Shop Creator is a comprehensive and powerful FiveM script that allows server administrators and authorized players to dynamically create, manage, and customize in-game shops through an intuitive user interface. This system enables the creation of a vibrant economy with both server-managed and player-owned businesses, complete with NPC vendors, interactive menus, and advanced features like job restrictions, robberies, and an employee system.

The script is built to be highly configurable and is compatible with major frameworks like ESX and QBCore, as well as modern targeting systems like `ox_target` and `qb-target`.

### General Functionality

The core of the Shop Creator is a powerful management UI, accessible via a server command (e.g., `/shopcreator`). From this menu, users with permission can:

* **Create and Delete Shops:** Establish new shop identities from scratch.
* **Manage Locations:** Place NPC vendors anywhere on the map, defining their model, position, and orientation.
* **Customize Appearance:** Configure map blips for each shop, including the icon, color, size, and name.
* **Add and Edit Products:** Populate shops with items, setting their price, category, and accepted payment methods (cash, bank, black money).
* **Set Restrictions:** Limit shop access to players with specific jobs and ranks.
* **Enable Player Ownership:** Turn any shop into a player-run business, where owners manage stock, employees, and finances.
* **Configure Robberies:** Allow players to rob shopkeepers, with configurable cooldowns, durations, and rewards.

Players interact with the spawned NPC vendors to open a clean, modern customer-facing UI where they can browse categories and purchase items.

### ✨ Features

* **In-Game Management UI:** No more manual database entries. Manage everything through a clean and user-friendly interface.
* **Dynamic NPC & Blip Spawning:** NPCs and blips are spawned and despawned based on player proximity to optimize performance.
* **Framework Compatibility:** Works with **ESX** and **QBCore** out of the box.
* **Target System Integration:** Supports **ox\_target** and **qb-target** for modern interaction, as well as a default 3D text-based system.
* **Player-Owned Shops:**
  * **Stock Management:** Owners must stock their shops using items from their personal inventory.
  * **Vault System:** A secure vault to manage shop earnings, separating legal and illegal tender.
  * **Employee System:** Hire other players as employees and set a commission percentage on their sales.
  * **Personal Payouts:** Employees and owners can withdraw their earnings from a personal vault.
* **NPC Robbery System:**
  * Players can aim at a shopkeeper to initiate a robbery.
  * Configurable duration and cooldown period between robberies.
  * Customizable rewards (items or money).
  * Alerts sent to specified jobs (e.g., police) with location blips.
* **Advanced Product Configuration:**
  * Assign products to custom categories.
  * Define multiple payment methods: cash, bank, black money, or a combination.
* **Job & Rank Restrictions:** Restrict shop access to certain jobs and minimum grade levels.
* **Discord Webhook Logging:** Keep track of purchases, stock changes, and employee actions with detailed Discord logs, complete with in-game screenshots.
* **Extensive Localization:** All text, both in-game and in the UI, is translatable. The script supports 12 languages by default.
