Skip to main content

🏪 Trade Hub (Marketplace)

The Trade Hub is a complete player economy market system. It allows players to rent physical market stalls in the world, stock them with goods, and generate passive income even while offline.

✨ Detailed Features

  • 📍 Physical Stalls: Each stall is a real object in the world. Inventory is tied to this specific location.
  • 💼 Management System: As an owner, you have full control over your business:
    • Pricing: Set individual prices for every item.
    • Stock Management: Add or remove goods easily.
    • Cashbox: Earnings go into the "Store Safe" and must be withdrawn manually.
  • ⏰ Skechdules (Opening Hours): Stalls can have realistic operating hours (e.g., 08:00 AM - 08:00 PM). Shopping is disabled outside these hours.
  • 📅 Rental System:
    • Rent is paid upfront for X days.
    • If rent expires, the stall is released (items are saved but must be retrieved).
    • Maximum rental duration is configurable.
  • 🌍 Localization & Currency: Supports RedM Dollars ($) and is fully translatable.

🎮 Guide: Owning a Stall

1. Find a Free Stall

Look around towns for stalls marked as "For Rent". This is usually indicated by floating text above the stall.

2. Renting

  1. Walk up to the stall and press [G].
  2. A menu shows the daily rent price (e.g., $10.00).
  3. Select how many days (1-7) you want to rent.
  4. After payment, the stall is yours!

3. Setup Your Shop

Press [G] at your owned stall to open the Management Menu.

Adding Stock

  1. Click the "Inventory" tab.
  2. You see your Satchel Inventory (left) and Stall Inventory (right).
  3. Drag items from your satchel into the stall.

Setting Prices

  1. Click on an item in the Stall Inventory.
  2. A window opens:
    • Price: Set the cost per single unit.
    • Amount: Decide how much of the stack you want to put up for sale.
  3. Confirm with "Update".

Tip: Watch your competition! If your neighbor sells apples for $0.50, don't charge $5.00.

4. Making Money

Other players can now approach your stall and press [G] (if open) to shop.

  • They see your listed items and prices.
  • When they buy, the money goes instantly into the Stall Cashbox.
  • You get a notification (if online).

Withdrawing Funds: Go to Management Menu -> Click "Withdraw" to transfer your earnings to your generic inventory/wallet.


⚙️ Important Configuration

Rent & Expiration

In config.lua, you control the market dynamics.

Config.CheckExpiredInterval = 3600000 -- (ms) How often server checks for expired rents? (Here: 1 Hour)

Config.Spots = {
{
-- ...
rentPrice = 100.0, -- Price per day
maxRentDays = 7, -- Max duration at once
}
}

Creating Schedules

You can create complex opening hours for different towns.

Config.Schedules = {
['blackwater_night_market'] = {
-- A night market, open only in the evening
['default'] = { open = 18, close = 4 } -- 6 PM to 4 AM
},
['valentine'] = {
['Sunday'] = { open = 0, close = 0 } -- Closed on Sundays
}
}

SQL Database

The system uses a JSON column in the database for inventory. This is performant and flexible. Ensure your oxmysql version is up to date.


📦 Admin & Troubleshooting

Force Releasing a Stall

If a player is inactive, you can intervene as Admin (in Database):

  1. Open table trade_hub_shops.
  2. Find the stall ID.
  3. Set owner_identifier to NULL.
  4. Restart script or wait for next check interval.

Debugging

Set Config.Debug = true to see in Server Console:

  • Who rents what?
  • Transactions and money flow.
  • Errors loading inventories.