Config Server
```lua
ESX, QBCore = nil, nil
if Config.Framework == 'ESX' then
TriggerEvent(Config.GetSharedObjects, function(obj)
ESX = obj
end)
elseif Config.Framework == 'QBCORE' then
TriggerEvent(Config.GetSharedObjects, function(obj)
QBCore = obj
end)
if QBCore == nil then
QBCore = exports[Config.ResourceName]:GetCoreObject()
end
elseif Config.Framework == "LEGACY" then
ESX = exports["es_extended"]:getSharedObject()
end
function SVNotify(source, type, text)
if Config.Notify == "rvl_notify" then
TriggerClientEvent("rvl_notify:DoNotify", source, type, text)
elseif Config.Notify == "other" then
-- Put here your notify. --
end
end
function PlFromId(source)
if Config.Framework == "ESX" or Config.Framework == "LEGACY" then
return ESX.GetPlayerFromId(source)
elseif Config.Framework == "QBCORE" then
return QBCore.Functions.GetPlayer(source)
end
end
function PlIdentifier(source)
local xPlayer = PlFromId(source)
if Config.Framework == "ESX" or Config.Framework == "LEGACY" then
return xPlayer.identifier
elseif Config.Framework == "QBCORE" then
return xPlayer.PlayerData.citizenid
end
end
function GetWalletMoney(source)
local xPlayer = PlFromId(source)
if Config.Framework == "ESX" or Config.Framework == "LEGACY" then
return xPlayer.getMoney()
elseif Config.Framework == "QBCORE" then
return xPlayer.Functions.GetMoney("cash")
end
end
function RemoveWalletMoney(source, amount)
local xPlayer = PlFromId(source)
if Config.Framework == "ESX" or Config.Framework == "LEGACY" then
return xPlayer.removeMoney(amount)
elseif Config.Framework == "QBCORE" then
return xPlayer.Functions.RemoveMoney("cash", amount)
end
end
function GetBankMoney(source)
local xPlayer = PlFromId(source)
if Config.Framework == "ESX" or Config.Framework == "LEGACY" then
return xPlayer.getAccount("bank").money
elseif Config.Framework == "QBCORE" then
return xPlayer.Functions.GetMoney("bank")
end
end
function RemoveBankMoney(source, amount)
local xPlayer = PlFromId(source)
if Config.Framework == "ESX" or Config.Framework == "LEGACY" then
return xPlayer.removeAccountMoney("bank", amount)
elseif Config.Framework == "QBCORE" then
return xPlayer.Functions.RemoveMoney("bank", amount)
end
end
function GetInvItem(source, item)
local xPlayer = PlFromId(source)
if Config.Framework == "ESX" or Config.Framework == "LEGACY" then
return xPlayer.getInventoryItem(item).count
elseif Config.Framework == "QBCORE" then
return xPlayer.Functions.GetItemByName(item).amount
end
end
function RemoveItem(source, item, quantity)
local xPlayer = PlFromId(source)
if Config.Framework == "ESX" or Config.Framework == "LEGACY" then
return xPlayer.removeInventoryItem(item, quantity)
elseif Config.Framework == "QBCORE" then
return xPlayer.Functions.RemoveItem(item, quantity)
end
end
```
Last updated