F.A.Q

2 min readUpdated 2 weeks ago

Setup

  1. Check the trader has valid coordinates set in the admin panel
  2. Verify Config.Settings.PedSpawnDistance: you may need to increase it
  3. Ensure the ped model exists (check shared/ped_models.lua for valid models)
  1. Items must be added to the shop through the admin panel
  2. Verify the item name matches your inventory system exactly
  3. Check that the item has stock > 0 (or unlimited stock enabled)

Admin

Open the admin panel with /shopadmin. From there you can create shops, assign traders with NPC models, add items with prices, set stock limits, and configure blips, all through the UI.

Players with the permission group set in Config.Settings.AdminPermission (default: admin) or the job set in Config.Settings.AdminJob.

Mechanics

Discounts are calculated per-player and per-shop. Use exports['ml_shops']:GetPlayerDiscount(shopId) to check the current discount. The final price is calculated with CalculateFinalPrice(basePrice, shopId).

Yes. Use the client export:

lua
1exports['ml_shops']:openShop('your_shop_id')

Stock is managed per item per shop. You can set stock through the admin panel or programmatically with SetItemStock and AddItemStock exports. When stock reaches 0, the item becomes unavailable until restocked.

Updates

  1. Download latest from CFX Portal
  2. Backup shared/config.lua and server/config_server.lua
  3. Replace all files except config
  4. Restart the resource

Shop data, traders, items, and stock are stored in the database and survive updates.