Exports
This script allows registering and opening dynamic shops on your FiveM server using simple exports and events.
Export: exports.lvs_shops:RegisterShop
exports.lvs_shops:RegisterShop
Syntax (server-side)
Parameters
shopId (string): A unique identifier for the shop.
shopData (table): A table containing the shop's settings and inventory.
shopData Structure
name (string): Display name of the shop.
inventory (table): A list of items available in the shop. Each item should be a table with:
name
(string): Item name.price
(number): Item price.type
(string, optional): Item type (for categorization or filtering).
groups (table): Restriction list based on player groups (e.g.,
police = 0
for group access).description (string, optional): A short description of the shop.
filters (table, optional): Used to organize shop items by categories. Each filter is a table with:
type
(string): The item type this filter applies to.label
(string): Display label for the filter.description
(string): Additional description for the filter.icon
(string): Icon for the filter (currently not implemented).
Example Usage
Event: lvs_shops:client:openRuntimeShop
lvs_shops:client:openRuntimeShop
Syntax (client-side)
Parameters
shopId (string): The ID of the shop you registered previously.
Description
This client-side event opens the specified runtime shop UI for the player.
Example Usage
Notes
shopId
must be unique when registering a new shop to avoid conflicts.You can expand the
shopData
with more optional fields like inshops.lua
oflvs_shops
if needed.Group restrictions (
groups
) allow you to make certain shops accessible only to specific player groups or jobs.
Last updated