📃Config
Config = {}
Config.CoreName = "qb-core" -- Your qb-core folder name
Config.Notify = "ox" -- "qb" / "ox" / okok ( open code on config_functions.lua )
Config.Display = "ox_lib" -- "ox_lib" or "lation_ui" ( open code on config_functions.lua )
Config.VespucciShops = {
["BikeRental"] = { -- Don't change
blipSettings = { enable = true, sprite = 226, scale = 0.8, colour = 3, name = "Bike Rental"},
pedLocation = vec4(-1266.17, -1419.4, 4.37, 121.47),
pedModel = "u_m_y_gabriel",
spawnBike = vec4(-1274.11, -1426.25, 4.36, 121.17),
icon = "fas fa-motorcycle",
label = "Rent a Bike",
bikesSelling = {
[1] = {
code = "bmx",
label = "BMX",
price = 500,
},
},
callback = function()
local options = {}
for _, bike in ipairs(Config.VespucciShops["BikeRental"].bikesSelling) do
table.insert(options, {
title = bike.label,
description = Language.price.. " ".. Language.currency .. bike.price,
icon = "bicycle",
onSelect = function()
RentBike(bike.code, bike.price, Config.VespucciShops["BikeRental"].spawnBike)
end,
})
end
RegisterContextMenu('bike_rental', 'Bike Rental', options)
ShowContextMenu('bike_rental')
end,
},
["MaskShop"] = {
blipSettings = { enable = true, sprite = 269, scale = 0.8, colour = 3, name = "Mask Shop"},
pedLocation = vector4(-1337.07, -1277.67, 4.88, 97.45),
pedModel = "a_m_y_juggalo_01",
icon = "fas fa-mask",
label = "Mask's Shop",
masksList = {
[1] = { name = "m_hockeymask", price = 25 },
[2] = { name = "m_monkeymask", price = 25 },
[3] = { name = "m_scarecrowmask", price = 25 },
[4] = { name = "m_skullmask", price = 25 },
[5] = { name = "m_terror", price = 25 },
[6] = { name = "m_bear", price = 25 },
[7] = { name = "m_bull", price = 25 },
[8] = { name = "m_cookie", price = 25 },
[9] = { name = "m_eagle", price = 25 },
[10] = { name = "m_eagle2", price = 25 },
[11] = { name = "m_fox", price = 25 },
[12] = { name = "m_owl", price = 25 },
[13] = { name = "m_pig", price = 25 },
},
callback = function()
local options = {}
for k,v in pairs(Config.VespucciShops["MaskShop"].masksList) do
table.insert(options, {
title = GetItemLabelFromInventory(v.name),
description = Language.price.. " ".. Language.currency .. v.price,
icon = GetImageFromInventory(v.name),
onSelect = function()
BuyItem(v.name, v.price)
end,
})
end
RegisterContextMenu('mask_shop', 'Mask Shop', options)
ShowContextMenu('mask_shop')
end,
},
["WineShop"] = {
blipSettings = { enable = true, sprite = 93, scale = 0.8, colour = 3, name = "Wine Shop"},
pedLocation = vector4(-1299.63, -1378.62, 4.49, 110.73),
pedModel = "cs_andreas",
icon = "fas fa-wine-bottle",
label = "Wine's Shop",
buySettings = { min = 1, max = 10, default = 1 },
winesList = {
[1] = { name = "m_sette", price = 75 },
[2] = { name = "m_bigbanyanmerlot", price = 75 },
[3] = { name = "m_tempranillo", price = 75 },
[4] = { name = "m_yorkarros", price = 75 },
[5] = { name = "m_myracabernet", price = 75 },
[6] = { name = "m_santacarolina", price = 75 },
[7] = { name = "m_budweiser", price = 75 },
[8] = { name = "m_corona", price = 75 },
[9] = { name = "m_stellaartois", price = 75 },
},
callback = function()
local options = {}
for k,v in pairs(Config.VespucciShops["WineShop"].winesList) do
table.insert(options, {
title = GetItemLabelFromInventory(v.name),
description = Language.price.. " ".. Language.currency .. v.price,
icon = GetImageFromInventory(v.name),
onSelect = function()
BuyItem(v.name, v.price)
end,
})
end
RegisterContextMenu('wine_shop', 'Wine Shop', options)
ShowContextMenu('wine_shop')
end,
},
}
Config.MaskSettings = {
Male = {
Terror = 57,
Hockey = 4,
Scare = 69,
Monkey = 3,
Skull = 2,
Bear = 21,
Bull = 23,
Cookie = 33,
Eagle = 196,
Eagle2 = 24,
Fox = 18,
Owl = 19,
Pig = 1,
},
Female = {
Terror = 57,
Hockey = 4,
Scare = 69,
Monkey = 3,
Skull = 2,
Bear = 21,
Bull = 23,
Cookie = 33,
Eagle = 196,
Eagle2 = 24,
Fox = 18,
Owl = 19,
Pig = 1,
},
}if GetResourceState("qb-core") == "started" then
QBCore = exports[Config.CoreName]:GetCoreObject()
elseif GetResourceState("es_extended") == "started" then
ESX = exports['es_extended']:getSharedObject()
end
function Notify(msg, type, time)
if Config.Notify == "qb" then
QBCore.Functions.Notify(msg, type, time)
elseif Config.Notify == "okok" then
exports['okokNotify']:Alert('Notification', msg, time, type, true)
elseif Config.Notify == "ox" then
lib.notify({ title = 'Notification', description = msg, type = type })
end
end
function SetFuel(bikeRented)
if GetResourceState("LegacyFuel") == "started" then
exports["LegacyFuel"]:SetFuel(bikeRented, 100.0)
elseif GetResourceState("okokFuel") == "started" then
exports['okokGasStation']:SetFuel(bikeRented, 100.0)
elseif GetResourceState("ox_fuel") == "started" then
SetVehicleFuelLevel(bikeRented, 100.0)
elseif GetResourceState("ti_fuel") == "started" then
exports["ti_fuel"]:setFuel(bikeRented, 100.0, "RON91")
elseif GetResourceState("qs-fuel") == "started" then
exports['qs-fuelstations']:SetFuel(bikeRented, 100.0)
end
end
function GiveKeys(bikeRented)
local plate = GetVehicleNumberPlateText(bikeRented)
local model = GetDisplayNameFromVehicleModel(GetEntityModel(bikeRented))
if GetResourceState("qb-vehiclekeys") == "started" then
TriggerEvent("vehiclekeys:client:SetOwner", plate)
elseif GetResourceState("qs-vehiclekeys") == "started" then
exports['qs-vehiclekeys']:GiveKeys(plate, model)
elseif GetResourceState("Renewed-Vehiclekeys") == "started" then
exports['Renewed-Vehiclekeys']:addKey(plate)
end
end
function RegisterContextMenu(id, title, options)
if Config.Display == "ox_lib" then
lib.registerContext({ id = id, title = title, options = options })
lib.showContext(id)
elseif Config.Display == "lation_ui" then
exports.lation_ui:registerMenu({ id = id, title = title, options = options })
exports.lation_ui:showMenu(id)
end
end
function ShowContextMenu(id)
if Config.Display == "ox_lib" then
lib.showContext(id)
elseif Config.Display == "lation_ui" then
exports.lation_ui:showMenu(id)
end
end
function HideContextMenu()
if Config.Display == "ox_lib" then
lib.hideContext()
elseif Config.Display == "lation_ui" then
exports.lation_ui:hideMenu()
end
end
function GetImageFromInventory(item)
if GetResourceState("qb-inventory") == "started" then
local qbItem = QBCore.Shared.Items[item]
return qbItem and "nui://qb-inventory/html/images/" .. qbItem.image
elseif GetResourceState("ox_inventory") == "started" then
local oxItem = exports.ox_inventory:Items(item)
return oxItem and oxItem.client and oxItem.client.image or item .. ".png"
end
end
function GetItemLabelFromInventory(item)
if GetResourceState("qb-inventory") == "started" then
return QBCore.Shared.Items[item] and QBCore.Shared.Items[item].label or item
elseif GetResourceState("ox_inventory") == "started" then
local oxItem = exports.ox_inventory:Items(item)
return oxItem and oxItem.label or item
end
end
function GetUserInput(title, fields)
if Config.Display == "ox_lib" then
return lib.inputDialog(title, fields)
elseif Config.Display == "lation_ui" then
return exports.lation_ui:input({
title = title or "",
options = fields
})
end
end
function GeneratePlate()
return "RENT"..math.random(1000, 4000)
end
function CreateBlip(coords, sprite, color, scale, text)
local blip = AddBlipForCoord(coords.x, coords.y, coords.z)
SetBlipSprite(blip, sprite)
SetBlipDisplay(blip, 4)
SetBlipScale(blip, scale)
SetBlipColour(blip, color)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentSubstringPlayerName(text)
EndTextCommandSetBlipName(blip)
return blip
endLast updated