π Framework Bridge
π Framework Bridge
We left the core integration bridge open source so you can adapt user fetching, job checks, or permissions flawlessly into your own custom framework environment.
Exit = Exit or {}
if Exit.framework == "qb" then
QBCore = exports["qb-core"]:GetCoreObject()
Exit.Functions = {
GetPlayer = function(source)
return QBCore.Functions.GetPlayer(source)
end,
GetPlayerIdentifier = function(source)
local player = QBCore.Functions.GetPlayer(source)
return player and player.PlayerData.citizenid or nil
end,
Notify = function(msg, type)
QBCore.Functions.Notify(msg, type)
end,
TriggerCallback = function(name, cb, ...)
QBCore.Functions.TriggerCallback(name, cb, ...)
end,
CreateCallback = function(name, cb)
QBCore.Functions.CreateCallback(name, cb)
end,
AddItem = function(source, item, amount)
local player = QBCore.Functions.GetPlayer(source)
if player then
player.Functions.AddItem(item, amount)
end
end,
RemoveItem = function(source, item, amount)
local player = QBCore.Functions.GetPlayer(source)
if player then
player.Functions.RemoveItem(item, amount)
end
end,
CreateUseableItem = function(item, cb)
QBCore.Functions.CreateUseableItem(item, cb)
end
}
elseif Exit.framework == "esx" then
ESX = exports["es_extended"]:getSharedObject()
Exit.Functions = {
GetPlayer = function(source)
return ESX.GetPlayerFromId(source)
end,
GetPlayerIdentifier = function(source)
local player = ESX.GetPlayerFromId(source)
return player and player.identifier or nil
end,
Notify = function(msg, type)
ESX.ShowNotification(msg)
end,
TriggerCallback = function(name, cb, ...)
ESX.TriggerServerCallback(name, cb, ...)
end,
CreateCallback = function(name, cb)
ESX.RegisterServerCallback(name, cb)
end,
AddItem = function(source, item, amount)
local player = ESX.GetPlayerFromId(source)
if player then
player.addInventoryItem(item, amount)
end
end,
RemoveItem = function(source, item, amount)
local player = ESX.GetPlayerFromId(source)
if player then
player.removeInventoryItem(item, amount)
end
end,
CreateUseableItem = function(item, cb)
ESX.RegisterUsableItem(item, cb)
end
}
end