📃Configs
Config = {}
-- General Settings --
Config.AutoDatabase = true -- If true, the script gona install the database automatic
Config.Framework = "QBCore" -- "QBCore", "ESX"
Config.Core = "qb-core" -- Your core resource name, only for QBCore
Config.Display = "lation_ui" -- "ox_lib", "lation_ui"
-- General Settings --
-- Zones Settings --
Config.Zones = {
checkZones = false, -- If true, the script will check if the player is in the zone to open the shop
zones = {
[1] = {
blip = { enable = true, name = "Street shops", sprite = 52, color = 2, scale = 0.7 }, -- Blip settings
middleCoords = vec3(2333.21, 2582.64, 46.67), -- Middle coords of the zone
radius = 50.0, -- Radius of the zone
}
}
}
-- Zones Settings --
-- Shop Settings --
Config.RaidEnable = true -- If true, the shop can be raided
Config.RaidTime = 10000 -- Time in ms to raid the shop
Config.RaidJobs = { "police" } -- Jobs that can raid the shop
Config.ItemsBlocked = { -- Items that can't be sold in the shops
"WEAPON_PISTOL",
}
-- Shop Settings --
-- Table Props --
Config.TableProps = { -- Props: https://gtahash.ru/objects/
{label = "prop_table_03", model = "prop_table_03"},
{label = "prop_table_04", model = "prop_table_04"},
{label = "prop_chair_01", model = "prop_chair_01"},
{label = "prop_tri_table_01", model = "prop_tri_table_01"},
{label = "prop_protest_table_01", model = "prop_protest_table_01"},
{label = "prop_astro_table_01", model = "prop_astro_table_01"},
{label = "prop_astro_table_02", model = "prop_astro_table_02"},
}if Config.Framework == "QBCore" then
QBCore = exports[Config.Core]:GetCoreObject()
elseif Config.Framework == "ESX" then
ESX = exports.es_extended:getSharedObject()
end
function Notify(msg, type, time)
if Config.Display == "ox_lib" then
lib.notify({ title = "Street Shops", description = msg, type = type, time = time })
elseif Config.Display == "lation_ui" then
exports.lation_ui:notify({ title = "Street Shops", description = msg, type = type, time = time })
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 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 ShowAlertDialog(header, content, labels)
labels = labels or { confirm = "Confirm", cancel = "Cancel" }
if Config.Display == "ox_lib" then
return lib.alertDialog({
header = header,
content = content,
centered = true,
cancel = true,
labels = labels
})
elseif Config.Display == "lation_ui" then
local result = exports.lation_ui:alert({
title = header,
content = content,
confirmText = labels.confirm,
cancelText = labels.cancel
})
return result == true and "confirm" or "cancel"
end
end
function ShowTextUI(text)
if Config.Display == "ox_lib" then
lib.showTextUI(text)
elseif Config.Display == "lation_ui" then
exports.lation_ui:showText({ description = text })
end
end
function HideTextUI()
if Config.Display == "ox_lib" then
lib.hideTextUI()
elseif Config.Display == "lation_ui" then
exports.lation_ui:hideText()
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
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 CreateTargetZone(name, pos, icon, label, job, action)
if GetResourceState("qb-target") == "started" then
exports["qb-target"]:AddBoxZone(name, vector3(pos.x, pos.y, pos.z), 1.5, 1.5,
{
name = name,
heading = pos.heading or 0,
minZ = pos.z - 1,
maxZ = pos.z + 1
},
{
options = {
{ icon = icon, label = label, job = job, action = action }
},
distance = Config.TargetDistance
}
)
return name
elseif GetResourceState("ox_target") == "started" then
local id = exports.ox_target:addBoxZone({
coords = vec3(pos.x, pos.y, pos.z),
size = vec3(1.5, 1.5, 1.5),
rotation = pos.heading or 0,
debug = false,
name = name,
options = {
{
icon = icon,
label = label,
groups = { job },
onSelect = action
}
},
distance = Config.TargetDistance
})
return id
end
end
Last updated