DXS STORE SYSTEM

DXS Store System

A comprehensive and interactive store system for FiveM, featuring a shopping trolley, category markers, a web-based UI, and integration with ox_inventory for item management and es_extended for player data and economy. This system supports multiple customizable shops, shop ownership, employee management, and a full Point of Sale (POS) system with self-checkout capabilities.

Features

  • Multiple Customizable Shops: Define various shops with unique IDs, labels, purchase prices, and item markups.

  • Shop Ownership: Players can purchase and own shops, gaining access to a boss menu for management.

  • Employee Management: Shop owners can hire and fire employees who can operate the POS system.

  • Shopping Trolley System: Optional trolley requirement for shopping, with interactive animations.

  • Category Markers: 3D markers for different item categories within each shop, enhancing navigation.

  • Web-based UI (NUI): Modern and interactive user interface for browsing items, managing the cart, and checkout.

  • Full Point of Sale (POS) System:

    • Cashier interface for employees/owners to process customer payments.

    • Self-checkout option for customers with items in their cart.

    • Discount application (percentage or flat rate).

    • Support for multiple payment methods (cash, card).

    • Transaction logging.

  • Inventory Integration: Seamlessly integrates with ox_inventory for adding purchased items to player inventories.

  • ESX Integration: Utilizes es_extended for player data, economy, and notifications.

  • Persistent Data: Shop states, transactions, and employee data are stored in a database.

  • Blips: Shops are marked on the map with customizable blips.

Requirements

Installation

  1. Clone or Download: Place the DXS_storesystem folder into your FiveM resources directory.

  2. Database Setup:

    • Import database.sql into your MySQL database. This will create the necessary tables for shops, transactions, and employees.

  3. Start Resource: Add ensure DXS_storesystem to your server.cfg.

  4. Dependencies: Ensure es_extended and ox_inventory are started before DXS_storesystem in your server.cfg.

    ensure es_extended
    ensure ox_inventory
    ensure DXS_storesystem

Configuration

The main configuration is done in config.lua.

  • Config.RequireTrolleyForShopping: Set to true if players must use a trolley to shop.

  • Config.CategoryMarkerDefaults: Customize the appearance of category markers (draw distance, type, scale, color).

  • Config.CategoryMenu: Configure the title and alignment of the category selection menu.

  • Config.CheckoutMenu: Configure the title and button labels for the checkout menu.

  • Config.Checkout:

    • brand: Brand name for the POS system.

    • currencySymbol: Symbol used for currency display.

    • locale: Locale for currency formatting.

    • taxRate: Sales tax rate (e.g., 0.05 for 5%).

    • paymentMethods: Available payment methods (e.g., {'cash', 'card'}).

    • employeeDiscountPercent: Default discount for employees.

    • discountLimits: Maximum percentage and flat discounts allowed.

  • Config.TrolleyModel: Specify the model name for the shopping trolley.

  • Config.Shops: This is a table where you define each individual shop. Each shop entry includes:

    • id: Unique identifier for the shop.

    • label: Display name of the shop.

    • purchasePrice: Price for a player to purchase the shop.

    • markup: Price increase for items sold in this shop (e.g., 0.10 for 10% increase).

    • purchaseCoords: Coordinates where players can purchase the shop.

    • blip: Blip settings (sprite, color, scale) for the shop on the map.

    • purchaseMarker, trolleyMarker, checkoutMarker: Marker settings (coords, text, type, scale, color) for interaction points.

    • categories: A table of item categories available in the shop. Each category has:

      • id: Unique identifier for the category.

      • label: Display name of the category.

      • coords: Coordinates for the category marker.

      • text: Text displayed when near the category marker.

      • items: A list of items within the category, each with name, label, and price.

Usage

Player Experience

  1. Locate a Shop: Find a shop blip on the map.

  2. Purchase a Shop (Optional): If a shop is unowned, approach the purchase marker and press E to buy it.

  3. Get a Trolley (if required): If Config.RequireTrolleyForShopping is true, interact with the trolley marker to get a shopping trolley.

  4. Browse Categories: Approach category markers within the shop and press E to open the shopping UI.

  5. Add to Cart: Select items from the UI to add them to your shopping cart.

  6. Checkout:

    • Self-Checkout: If no employee is available, approach the checkout marker with items in your cart and press E for self-checkout.

    • Cashier Checkout: An employee or owner can process your payment at the POS.

  7. Boss Menu (for Owners): Owners can access a boss menu at the purchase marker to manage funds, employees, and shop logo.

Shop Owner/Employee Experience

  1. Access POS: Approach the checkout marker and press E to open the POS system.

  2. Process Payments: As a cashier, you can select a customer's cart, apply discounts, and process payments (cash or card).

  3. Manage Shop (Owners Only): At the purchase marker, owners can access the boss menu to:

    • Withdraw/deposit funds from the shop's account.

    • Hire and fire employees.

    • Update the shop's logo URL.

Database Structure

The script uses the following tables:

  • dxs_storesystem_shops:

    • id (VARCHAR): Unique shop identifier.

    • label (VARCHAR): Display name of the shop.

    • purchase_price (INT): Price to purchase the shop.

    • markup (FLOAT): Item price markup for the shop.

    • owner_identifier (VARCHAR): Identifier of the shop owner.

    • owner_name (VARCHAR): Name of the shop owner.

    • funds (INT): Current funds in the shop's account.

    • logo_url (VARCHAR): URL for the shop's logo.

    • created_at (TIMESTAMP): Timestamp of shop creation.

  • dxs_storesystem_transactions:

    • id (INT, AUTO_INCREMENT): Unique transaction ID.

    • shop_id (VARCHAR): ID of the shop where the transaction occurred.

    • type (VARCHAR): Type of transaction (e.g., 'Deposit', 'Withdraw', 'Sale').

    • amount (INT): Amount of the transaction.

    • employee_name (VARCHAR): Name of the employee who processed the transaction (or 'System').

    • timestamp (TIMESTAMP): Timestamp of the transaction.

  • dxs_storesystem_employees:

    • id (INT, AUTO_INCREMENT): Unique employee ID.

    • shop_id (VARCHAR): ID of the shop the employee works for.

    • identifier (VARCHAR): Player identifier of the employee.

    • name (VARCHAR): Name of the employee.

    • role (VARCHAR): Role of the employee (e.g., 'employee', 'owner').

    • hire_date (TIMESTAMP): Timestamp when the employee was hired.

Credits

  • DXS for the original script.

  • ESX Framework for the base.

  • ox_inventory for inventory management.

Last updated