🛍️Adding new shop
How to Add New Shops
How to Add New Shops
To add new shops, you need to create a new entry in the Config.Shops table with a unique identifier for each shop. The general steps are:
Create a Unique Shop ID: Each shop should have a unique key to identify it. For example, if you’re adding a new shop called "Clothing Store", you might use
'clothing_store'as the key.Configure Shop Settings: Under the unique key (e.g.,
'clothing_store'), configure the settings for that shop, such as titles, colors, currency, and more.
Detailed Breakdown of the Shop Configuration
titles:main: The main name of the shop (displayed in the UI).secondary: A secondary title, often used for additional description or categorization (e.g., "MARKET", "SUPPLY").description: A short description of what the shop offers.
colors:accent: The color used for accent details (e.g., button highlights).background: The background color for the shop’s UI.text: The color of the text used in the shop interface.
currency:This is the currency used in the shop. It could be
money,bank, or any custom currency that your server uses.
blip:sprite: The icon displayed on the map for the shop.color: The color of the icon on the map.scale: The size of the icon.display: The type of map display (e.g., whether the blip is displayed on the radar).label: The label that appears when the player hovers over the blip on the map.visible: Whether the blip is visible on the map (trueorfalse).
npc:name: The name of the NPC who will interact with players in the shop.hash: The hash value of the NPC model (used to spawn the NPC).scenario: The scenario or animation the NPC will perform (e.g., standing with a clipboard).target: The interaction information for the NPC, such as the icon and label displayed when interacting with the NPC.icon: The icon to display above the NPC's head.label: The text displayed when interacting with the NPC (e.g., "Talk to the Shopkeeper").distance: The interaction distance.
categories:Each shop can have multiple categories of products. Each category contains settings such as:
name: The name of the category (e.g., "Food & Drinks", "Electronics").type: Type of the category (usually "Products").icon: An icon that represents the category in the shop UI.specialOffers: Optional settings for offering discounts in night:percentage: A random discount percentage applied to the category.maxProducts: The maximum number of products eligible for special offers.
products:Each product in the shop is defined with the following settings:
category: The category the product belongs to (e.g., "food", "electronics").item: The unique identifier of the item.label: The product’s name shown in the shop.description: Descriptions about the product, such as rarity or count.count: The quantity of the product available.weight: The weight of the item (useful for inventory systems).price: The price of the product in the shop's currency.image: The URL for the image of the product.salePercentage: Optional sale percentage for a product, if it's on sale.
locations:Each shop can have one or more locations defined using coordinates in
vec4format. These coordinates specify the shop’s position in the world.Example:
vec4(-47.5092, -1758.8894, 28.4210, 47.3490)represents a specific location in the game world where the shop can be found.
Example: Adding a New Shop
Here’s how you would add a new shop named "Clothing Store":
Config.Shops['clothing_store'] = {
titles = {
main = 'Clothing Store',
secondary = 'Fashion Hub',
description = 'Shop for the latest in fashion and clothing!'
},
colors = {
accent = '#ff4500', -- Orange accent color
background = '#ffffff', -- White background
text = '#000000', -- Black text
},
currency = 'money',
blip = {
sprite = 73, -- Icon for a clothing store
color = 5, -- Blip color
scale = 0.8,
display = 4,
label = 'Clothing Store',
visible = true,
},
npc = {
name = 'Anna',
hash = 0xE79782E2, -- NPC model hash for Anna
scenario = 'WORLD_HUMAN_STAND_IMPATIENT',
target = {
icon = 'fas fa-tshirt',
label = 'Clothing Store',
distance = 2.0,
}
},
categories = {
['clothing'] = {
name = "Clothing",
type = "Products",
icon = "Tshirt",
specialOffers = {
percentage = math.random(5, 10),
maxProducts = 5
}
},
},
products = {
{
category = "clothing",
item = "jacket",
label = "Leather Jacket",
description = {
{title = "Rarity", value = "Rare"},
{title = "Count", value = "1"}
},
count = 1,
weight = 1200.00,
price = 500,
image = "nui://clothing-shop/images/jacket.png"
}
},
locations = {
vec4(100.0, -200.0, 29.0, 90.0) -- Example location for the clothing store
},
}Summary
Config.Shopsis where you define all the shops on your server.Each shop has a unique identifier (e.g.,
'shop_1','clothing_store'), and you can set various properties like titles, colors, products, NPCs, categories, and locations.Adding a new shop involves creating a new entry in
Config.Shopswith a unique key and configuring all the desired settings.
Last updated