๐Ÿ‘จโ€๐Ÿ’ปInitializing/Configuration

A guide on how to generate vehicle list

Add Export for QB Based Inventory

Create a export if not exist in qb-inventory/server.lua

-- Stash Items
local function GetStashItems(stashId)
	local items = {}
	local result = MySQL.scalar.await('SELECT items FROM stashitems WHERE stash = ?', {stashId})
	if not result then return items end

	local stashItems = json.decode(result)
	if not stashItems then return items end

	for _, item in pairs(stashItems) do
		local itemInfo = QBCore.Shared.Items[item.name:lower()]
		if itemInfo then
			items[item.slot] = {
				name = itemInfo["name"],
				amount = tonumber(item.amount),
				info = item.info or "",
				label = itemInfo["label"],
				description = itemInfo["description"] or "",
				weight = itemInfo["weight"],
				type = itemInfo["type"],
				unique = itemInfo["unique"],
				useable = itemInfo["useable"],
				image = itemInfo["image"],
				slot = item.slot,
			}
		end
	end
	return items
end

exports('GetStashItems', GetStashItems)

Generate Vehicle List

Step 1: Start the scripts as in order provided here and join the server

Step 2: On F8 console/chat try executing this command generatevehlist and wait for the script to retrive all vehicle data from core.

Step 3: Upon Completion you will see files/folders introducing in mm_dealership/data/ folder

Add new Vehicles/Categories

// category template
return {
	name: string = "Category Label",
	category: string = "Category Name",
	shop: string = "shop id as in shops.lua",
	vehicles = {
		{ // vehicle template
			speed: number = "Speed of vehicle",
			nickname: string = "Nickname of vehicle",
			control: number = "Control of vehicle",
			stock: number = 1, // dont change this, set it to 1
			hash: string = "model name", 
			manufacturer: string = "Manufacturer Name",
			category: string = "Category Label",
			braking: number = "Braking of vehicle",
			shop: string = "shop id as in shops.lua",
			discountPrice: number = -1, // set to -1 if no discount
			dealerPrice: number = "Price of vehicle at vehicle import", 
			testDrivePrice: number = "Price of test drive, -1 to remove test drive",
			price: number = "Price of vehicle at shop",
			model: string = "Full name of Vehicle",
			acceleration: number = "Acceleration of vehicle",
		},
		{
			speed = 168,
			nickname = "",
			control = 84,
			stock = 1,
			hash = "jester2",
			manufacturer = "Dinka",
			category = "Sports",
			braking = 71,
			shop = "pdm",
			discountPrice = -1,
			dealerPrice = 156600,
			testDrivePrice = 1740,
			price = 174000,
			model = "Dinka Jester Racecar",
			acceleration = 31,
		},
	}
}

Last updated