Legacy Scripts

legacy-shops

Overview

What legacy-shops is and how it fits together.

legacy-shops

An in-game shop creator and store system for FiveM. Admins build shops directly in-world through an NUI creator; players interact with the resulting shopkeeper peds to buy items through a store UI.

What it does

  • Admin shop creator — an NUI (opened via Config.CreatorCommand or the OpenCreator export) for placing shopkeeper peds in the world, defining categories and items, configuring blips, and saving reusable presets (templates with ped model, blip config, job locks, categories and items).
  • In-game store — players target a shop ped to open a store UI (OpenStore export) showing categories, items, current prices/stock, and their cash/bank balance, enforcing job/grade locks, weapon licences, and alternate-currency (item-based) payment.
  • Presets — a built-in catalogue (ported from ox_inventory's data/shops.lua) seeds customPresets on first boot, with real-world placement coordinates available per preset. Presets can be edited later; every shop placed from a preset can be re-synced to the preset's current catalogue.
  • Restocking & price fluctuation — independent timed loops that refill finite-stock items and randomly vary prices within a configured range, broadcasting updates to clients.
  • Optional blip management — shop blips can integrate with a separate legacy-blipmanager resource for an all/closest/none visibility toggle; without it, blips still work with sane defaults.

Data model

Live shop/preset state is stored in data/shops.json (managed through legacy-lib's Store), not directly in SQL. The database tables (legacy_shops, legacy_shops_categories, legacy_shops_items, legacy_shops_presets) are only read once, automatically, to migrate a legacy/fresh install into that JSON store. The one exception is legacy_shops_history, an append-only SQL log of every purchase, which stays live for the life of the resource.

Frontend

The creator and store UI are a Vite + React + Tailwind app under web/, built to web/dist and loaded as NUI. Locale strings live in locales/en.json and locales/sv.json.

See Installation for setup steps, and the Configuration, Integration, and Troubleshooting pages for the rest.