🏪 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
- Walk up to the stall and press [G].
- A menu shows the daily rent price (e.g., $10.00).
- Select how many days (1-7) you want to rent.
- After payment, the stall is yours!
3. Setup Your Shop
Press [G] at your owned stall to open the Management Menu.
Adding Stock
- Click the "Inventory" tab.
- You see your Satchel Inventory (left) and Stall Inventory (right).
- Drag items from your satchel into the stall.
Setting Prices
- Click on an item in the Stall Inventory.
- A window opens:
- Price: Set the cost per single unit.
- Amount: Decide how much of the stack you want to put up for sale.
- 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):
- Open table
trade_hub_shops. - Find the stall ID.
- Set
owner_identifiertoNULL. - 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.