Rex Market
Description
A player-owned market stall system for RedM (RSG-Core). Players place a physical stall in the world, stock it with items from their inventory at their own prices, and other players can browse and buy from it through a themed NUI shop. Stalls decay over time and need repairing, and owners can collect and withdraw the money they've earned.
Placeable market stalls Players use a marketstall item to enter a placement mode (free-look camera raycast + hold-to-confirm prompts, with left/right rotation) and drop a physical stall prop in the world. Placement respects a minimum distance from other stalls, can be restricted from town zones, and is capped per player via Config.MaxMarkets.
Owner management panel The stall's owner gets a tabbed NUI panel with:
- Inventory — list items from their own inventory for sale, set a price and quantity, and restock or remove listings at any time (removing returns the stock to the owner's inventory).
- Till — view the stall's accumulated cash and withdraw it to their own money.
- Maintenance — see the stall's condition (0–100%) and pay to repair it back to 100%.
-
Pack Up — remove the stall entirely, automatically refunding any leftover stock and till money before returning the
marketstallitem.
Customer shopping experience Anyone else who interacts with a stall gets a store-style shopping view instead of the owner tabs:
- Quantity steppers and an "Add to Cart" button on every item, capped to live stock.
- A cart button with a live item-count badge, opening a dedicated cart screen where quantities can be adjusted or items removed, with a running total.
- A single Checkout button purchases everything in the cart in one action. All pricing/stock validation happens server-side per item (atomic, race-safe), so the cart is purely a client-side convenience layer.
Stall condition & upkeep Stall condition decays automatically over time (Config.UpkeepCronJob) and can optionally require a minimum item quality (Config.EnableQualityCheck / Config.MinimumQuality) before stock can be sold at all. Owners must keep condition above 0% — a stall left to decay to 0 is automatically removed and logged.
Stock cleanup A second cron job (Config.StockCronJob) periodically clears out fully depleted stock listings.
Blacklist system Config.BlacklistItems prevents specific items (weapons, ammo, currency, and the stall item itself by default) from ever being listed for sale, checked both client-side (to keep the UI clean) and server-side (source of truth).
Security-hardened server logic
- Stock purchases use a single atomic conditional
UPDATEso two buyers can't oversell the same stock. - Withdrawals and pack-up/removal both verify the requesting player actually owns the market before doing anything.
- Item quality and price/stock are always re-validated server-side, never trusted from the client.
Map presence Placed stalls show a configurable blip (Config.Blip) and use vegetation clearing around the stall if enabled (Config.EnableVegModifier).
Version checking On start, the resource checks its version against a hosted version.txt and prints a warning to console if you're out of date.
Do I get the source code?
Config files are open-source for full customization, however core script files are protected by Cfx.re Escrow to prevent theft and leaks.
What happens after purchase?
The script appears in your Cfx.re Keymaster under Granted Assets. Download it, drop it into your resources folder, and add it to your server.cfg.
Can I transfer it to another account?
Escrow transfers can be done once through Keymaster and are irreversible, make sure you purchase on the correct Cfx.re account.
Need help?
Visit my Discord server for support