๐Ÿ›๏ธTrader Shop System

Overview

hate-traders is a comprehensive trading system for FiveM servers that allows players to buy and sell items through various trading locations. The script supports different market types (traders, fence, black market) and includes features like stock management, multilingual support, and customizable NPCs.

Features

  • Multiple Market Types: Configure different types of markets (traders, fence, black market)

  • Stock Management: Each item has its own stock that replenishes over time

  • Infinity Stock Option: Special "-1" stock value for items with unlimited availability

  • Buy/Sell Permissions: Control which items can be bought or sold with individual flags

  • Item Metadata Support: Items can have metadata like durability, registration status, etc.

  • Multilingual Support: Built-in support for English, Turkish, and German languages

  • Dynamic UI: Modern and responsive NUI interface with dynamic content generation

  • Framework Support: Compatible with both QBCore and ESX frameworks

  • NPC & Blip Customization: Fully customizable NPCs and map blips

  • Category System: Items can be organized into categories for easy navigation

  • Customizable Markers: Full control over marker appearance, size, and colors

  • Extensible Market Types: Easily add new market types with custom marker colors

Installation

Requirements

  • QBCore or ESX Framework

  • oxmysql

Setup Instructions

  1. Download and Extract

    • Download the resource and extract it to your server's resources folder

    • Ensure the folder is named hate-traders

  2. Database Setup

    • The script will automatically create required database tables on first start

    • Required table: market_stocks

  3. Configure the Script

    • Open config.lua to customize market locations, items, and settings

    • Set Config.Framework to either "qbcore" or "esx" depending on your server

    • Set Config.Locale to your desired language ("en", "tr", or "de")

  4. Add to Server.cfg

    • Add ensure hate-traders to your server.cfg file

  5. Restart Your Server

    • Restart your server for the changes to take effect

Configuration

Main Configuration Options

Market Location Setup

Each market location can be configured with these properties:

Item Configuration

Items can be configured with these properties:

Exports

The script provides the following exports that can be used by other resources:

Client-side Exports

  1. OpenMarket Opens a specific market type

  2. CloseMarket Closes the currently open market

Language Support

The script includes complete translations for English, Turkish, and German languages. You can change the active language by modifying the Config.Locale setting in the config.lua file.

To add a new language, you can create a new entry in the languages.lua file following the existing language structure.

Customization

Adding New Items

To add new items to the markets, add them to the respective market type in the Config.Items table.

Creating New Market Types

You can create new market types by adding a new key to the Config.Items table and then adding locations with that type.

Custom Currency System

The script uses item-based currency by default. The main currency item is defined in Config.MoneyItem.

Advanced Features

Stock System

Each item has its own stock that is tracked server-side and stored in the database. Stocks automatically replenish over time based on the Config.StockUpdateInterval setting.

Infinity Stock

Set an item's stock value to -1 to give it unlimited stock. Items with infinity stock:

  • Display an infinity symbol (โˆž) in the UI

  • Never run out of stock when purchased

  • Synchronize between database and config

Buy/Sell Permissions

Each item can have individual buy and sell permissions:

  • canBuy: Controls whether players can purchase the item (defaults to true)

  • canSell: Controls whether players can sell the item back (defaults to true)

The UI will automatically hide buy/sell tabs if no items are available for that mode in the current market.

Item Metadata

When configuring items, you can add metadata that will be transferred to the player's inventory when they purchase the item. This can include properties like:

  • Durability

  • Serial numbers

  • Registration status

  • Any other custom properties

Troubleshooting

Common Issues

  1. Items not appearing in the shop

    • Ensure the item exists in your server's shared items list

    • Check that the market type is correctly configured

    • Verify that the item's canBuy or canSell flags are not set to false

  2. NPCs not spawning

    • Verify that Config.EnablePeds is set to true

    • Check that the NPC models are valid and available on your server

  3. Translation issues

    • Make sure the language key in Config.Locale matches one of the available languages

    • Check if the translation key exists in the selected language

  4. Stock not synchronizing

    • If infinity stock (-1) is not working, verify your database supports negative values

    • Check server console for any SQL-related errors

Support

For additional support, please refer to the official documentation or contact the developer.

Note: This script has encrypted client and server files. The documentation only covers the available exports and configuration options.