config.server.lua
Preview File Updated: v2.0.0 - 22.08.2026
SV = {}
-- ██████╗ ███╗ ██╗██╗ ██╗ ██╗ ███████╗███████╗██╗ ██╗
-- ██╔═══██╗████╗ ██║██║ ╚██╗ ██╔╝ ██╔════╝██╔════╝╚██╗██╔╝
-- ██║ ██║██╔██╗ ██║██║ ╚████╔╝ █████╗ ███████╗ ╚███╔╝
-- ██║ ██║██║╚██╗██║██║ ╚██╔╝ ██╔══╝ ╚════██║ ██╔██╗
-- ╚██████╔╝██║ ╚████║███████╗ ██║ ███████╗███████║██╔╝ ██╗
-- ╚═════╝ ╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚══════╝╚══════╝╚═╝ ╚═╝
SV.UsersPrefix = 'char'
SV.Identifier = 'steam' -- this is the identifier you use in the users table, if you use R* license set "license", if steam set "steam"
SV.DatabaseToRemove = {
{table = 'users', column = 'identifier'},
{table = 'owned_vehicles', column = 'owner'},
{table = 'user_licenses', column = 'owner'},
{table = 'datastore_data', column = 'owner'},
-- Here you can add more tables that you want it to delete when deleting a character.
}
-- ███████╗██████╗ █████╗ ███╗ ███╗███████╗██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗
-- ██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝██║ ██║██╔═══██╗██╔══██╗██║ ██╔╝
-- █████╗ ██████╔╝███████║██╔████╔██║█████╗ ██║ █╗ ██║██║ ██║██████╔╝█████╔╝
-- ██╔══╝ ██╔══██╗██╔══██║██║╚██╔╝██║██╔══╝ ██║███╗██║██║ ██║██╔══██╗██╔═██╗
-- ██║ ██║ ██║██║ ██║██║ ╚═╝ ██║███████╗╚███╔███╔╝╚██████╔╝██║ ██║██║ ██╗
-- ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝
SV.GetPlayer = function(src)
if Config.Core == "ESX" then
return Core.GetPlayerFromId(src)
elseif Config.Core == "QB-Core" or Config.Core == "QBX" then
return Core.Functions.GetPlayer(src)
end
end
SV.GetSource = function(xPlayer)
if Config.Core == "ESX" then
return xPlayer.source
elseif Config.Core == "QB-Core" or Config.Core == "QBX" then
return xPlayer.PlayerData.source
end
end
SV.AddItem = function(src, xPlayer, name, count, metadata)
if GetResourceState('codem-inventory') == 'started' then
exports['codem-inventory']:AddItem(src, name, count, nil, metadata)
elseif GetResourceState('core_inventory') == 'started' then
exports['core_inventory']:addItem(src, name, count, metadata)
elseif GetResourceState('jaksam_inventory') == 'started' then
exports['jaksam_inventory']:addItem(src, name, count, metadata)
elseif GetResourceState('one_inventory') == 'started' then
exports['one_inventory']:AddItem(src, name, count, metadata)
elseif GetResourceState('origen_inventory') == 'started' then
exports['origen_inventory']:addItem(src, name, count, nil, metadata)
elseif GetResourceState('ox_inventory') == 'started' then
exports['ox_inventory']:AddItem(src, name, count, metadata)
elseif GetResourceState('ps-inventory') == 'started' then
exports['ps-inventory']:AddItem(src, name, count, nil, metadata)
elseif GetResourceState('qb-inventory') == 'started' then
exports['qb-inventory']:AddItem(src, name, count, false, metadata)
elseif GetResourceState('tgiann-inventory') == 'started' then
exports["tgiann-inventory"]:AddItem(src, name, count, false, metadata, false)
else
if Config.Core == "ESX" then
xPlayer.addInventoryItem(name, count)
elseif Config.Core == "QB-Core" or Config.Core == "QBX" then
xPlayer.Functions.AddItem(name, count)
end
end
end
SV.AddMoney = function(src, xPlayer, account, amount)
if Config.Core == "ESX" then
xPlayer.addAccountMoney(account, amount)
elseif Config.Core == "QB-Core" or Config.Core == "QBX" then
xPlayer.Functions.AddMoney(account, amount)
end
end
SV.RegisterCommand = function(command, groups, cb, help, suggestions)
if Config.Core == "ESX" then
local arguments = {}
if suggestions then
for k, v in pairs(suggestions) do
table.insert(arguments, {
name = v.name,
help = v.label,
type = 'any'
})
end
end
Core.RegisterCommand(command, groups, function(xPlayer, args, showError)
local src = SV.GetSource(xPlayer)
cb(src, args)
end, false, {
help = help,
arguments = arguments
})
elseif Config.Core == "QB-Core" or Config.Core == "QBX" then
local arguments = {}
if suggestions then
for k, v in pairs(suggestions) do
table.insert(arguments, {
name = v.name,
help = v.label
})
end
end
Core.Commands.Add(command, help, arguments, false, function(source, args)
cb(source, args)
end, groups)
end
end
SV.GetJobs = function()
if Config.Core == "ESX" then
if Core.GetJobs then
return Core.GetJobs()
end
return exports['es_extended']:getSharedObject().Jobs
end
return {}
end
SV.LoadHouseData = function(src)
if Config.Core == "QB-Core" or Config.Core == "QBX" then
local Houses = {}
local HouseGarages = {}
local success, result = pcall(function()
return MySQL.query.await('SELECT * FROM houselocations', {})
end)
if success and result and next(result) then
for _, v in pairs(result) do
local owned = tonumber(v.owned) == 1
local garage = v.garage ~= nil and json.decode(v.garage) or {}
Houses[v.name] = {
coords = json.decode(v.coords),
owned = owned,
price = v.price,
locked = true,
adress = v.label,
tier = v.tier,
garage = garage,
decorations = {},
}
HouseGarages[v.name] = {
label = v.label,
takeVehicle = garage,
}
end
end
TriggerClientEvent("qb-garages:client:houseGarageConfig", src, HouseGarages)
TriggerClientEvent("qb-houses:client:setHouseConfig", src, Houses)
end
end
SV.Starter = function(src, xPlayer)
endLast updated