Defines bundles available for purchase, including vehicle packs, weapon packs, and currency packs.
Example Bundle:
price: Cost of the bundle.
label: Label for the bundle.
title: Title of the bundle.
count: Number of items in the bundle.
items: List of items in the bundle.
Bundles = {
{
price = 100,
label = 'VEHICLE PACK',
title = 'Vehicles',
count = 6,
items = {
{ image = './assets/img/car/t20.png', name = 'T20', category = 'SUPER', quantity = 1, model = 't20', type = 'vehicle' },
{ image = './assets/img/car/zentorno.png', name = 'Zentorno', category = 'SUPER', quantity = 1, model = 'zentorno', type = 'vehicle' },
-- More vehicle items...
},
},
{
price = 200,
label = 'WEAPON PACK',
title = 'Weapons',
count = 6,
items = {
{ image = './assets/img/weapon/WEAPON_PISTOL.png', name = 'Pistol', category = 'HANDGUN', quantity = 1, code = 'weapon_pistol', type = 'weapon' },
{ image = './assets/img/weapon/WEAPON_COMBATPISTOL.png', name = 'Combat Pistol', category = 'HANDGUN', quantity = 1, code = 'weapon_combatpistol', type = 'weapon' },
-- More weapon items...
},
},
{
price = 300,
label = 'PRICE PACK',
title = 'Prices',
count = 6,
items = {
{ image = './assets/img/coin/100000.png', name = 'Cash Bundle', category = 'CURRENCY', quantity = 1, amount = 10000, type = 'currency' },
{ image = './assets/img/coin/100000.png', name = 'Gold Bar', category = 'CURRENCY', quantity = 1, amount = 5000, type = 'currency' },
-- More currency items...
},
},
},
SetVehicleKeys
Sets the owner of the vehicle with the specified license plate.
function SetVehicleKeys(plate)
TriggerEvent('vehiclekeys:client:SetOwner', plate)
end
GeneratePlate
Generates a vehicle license plate based on the specified format.
function GeneratePlate()
local plate = Config.PlateFormat
local nums = "0123456789"
plate = plate:gsub("#", function()
return nums:sub(math.random(1, #nums), math.random(1, #nums))
end)
return plate
end
GetFramework
function GetFramework()
local Get = nil
if Config.Framework == "ESX" then
while Get == nil do
TriggerEvent('esx:getSharedObject', function(Set) Get = Set end)
Citizen.Wait(0)
end
elseif Config.Framework == "NewESX" then
Get = exports['es_extended']:getSharedObject()
elseif Config.Framework == "QBCore" then
Get = exports["qb-core"]:GetCoreObject()
elseif Config.Framework == "OLDQBCore" then
while Get == nil do
TriggerEvent('QBCore:GetObject', function(Set) Get = Set end)
Citizen.Wait(200)
end
end
return Get
end
GetDiscordAvatar
Fetches the Discord avatar for a user.
function GetDiscordAvatar(userID, callback)
DiscordRequest("GET", "users/"..userID, {}, function(data, error)
if not error and data and data.avatar then
local avatarURL = string.format("https://cdn.discordapp.com/avatars/%s/%s.png", userID, data.avatar)
callback(avatarURL)
else
callback(nil)
end
end)
end
DiscordRequest
Performs an HTTP request to the Discord API.
function DiscordRequest(method, endpoint, jsondata, callback)
PerformHttpRequest("https://discord.com/api/"..endpoint, function(errorCode, resultData, resultHeaders)
if errorCode == 200 then
local data = json.decode(resultData)
callback(data, nil)
else
callback(nil, errorCode)
end
end, method, #jsondata > 0 and json.encode(jsondata) or "", {["Content-Type"] = "application/json", ["Authorization"] = "Bot " .. Config.Discord})
end
Overview
This documentation provides an overview of the configuration settings for a script that integrates various elements like vehicle bundles, weapon packs, and currency packs within a QBCore or ESX framework. It also includes functionality for setting vehicle keys, generating license plates, and interacting with the Discord API.
Configuration Settings
Framework
Framework: Specifies the framework being used. Possible values are 'QBCore', 'ESX', 'OLDQBCore', or 'NewESX'.
Plate Format
PlateFormat: Format for vehicle license plates. Example: "VIP####" where # is replaced by a random number.
Phone System
Phone: Specifies the phone system being used. Possible values are "qb-phone", "gksphone", or "gcphone".