This commit is contained in:
Nordi98 2025-07-20 22:12:41 +02:00
parent 702bab121c
commit 9aa690dfc4
37 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,42 @@
if GetResourceState('es_extended') ~= 'started' then return end

Core.Info.Framework = 'ESX'
local ESX = exports["es_extended"]:getSharedObject()

Core.Framework = {}

function Core.Framework.Notify(message, type)
local resource = Cfg.Notification or 'default'
if resource == 'default' then
ESX.ShowNotification(message, type)
elseif resource == 'ox' then
lib.notify({ description = message, type = type, position = 'top' })
elseif resource == 'custom' then
-- insert your notification system here
end
end

function Core.Framework.GetPlayerName()
local first = ESX.PlayerData.firstName
local last = ESX.PlayerData.lastName
return first, last
end

function Core.Framework.ToggleOutfit(wear, outfits)
if wear then
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin)
local gender = skin.sex
local outfit = gender == 1 and outfits.Female or outfits.Male
if not outfit then return end
TriggerEvent('skinchanger:loadClothes', skin, outfit)
end)
else
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin)
TriggerEvent('skinchanger:loadSkin', skin)
end)
end
end

function Core.Framework.GetPlayerMetadata(meta)
return ESX.GetPlayerData().metadata[meta]
end

View file

@ -0,0 +1,99 @@
if GetResourceState('es_extended') ~= 'started' then return end

Core.Info.Framework = 'ESX'
local ESX = exports["es_extended"]:getSharedObject()

Core.Framework = {}

function Core.Framework.Notify(src, message, type)
local src = src or source
local resource = Cfg.Notification
if resource == 'default' then
TriggerClientEvent('esx:showNotification', src, message, type)
elseif resource == 'ox' then
TriggerClientEvent('ox_lib:notify', src, { description = message, type = type, position = 'top' })
elseif resource == 'custom' then
-- insert your notification export here
end
end

function Core.Framework.GetPlayerIdentifier(src)
local src = src or source
local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
return xPlayer.getIdentifier()
end

function Core.Framework.GetPlayerName(src)
local src = src or source
local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
return xPlayer.variables.firstName, xPlayer.variables.lastName
end

function Core.Framework.GetPlayerJob(src)
local src = src or source
local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
return xPlayer.getJob().name, xPlayer.getJob().label
end

function Core.Framework.GetPlayerJobGrade(src)
local src = src or source
local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
return xPlayer.getJob().grade, xPlayer.getJob().grade_label
end

function Core.Framework.GetAccountBalance(src, account)
local src = src or source
local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
return xPlayer.getAccount(account).money
end

function Core.Framework.AddAccountBalance(src, account, amount)
local src = src or source
local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
xPlayer.addAccountMoney(account, amount)
end

function Core.Framework.RemoveAccountBalance(src, account, amount)
local src = src or source
local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
xPlayer.removeAccountMoney(account, amount)
end

function Core.Framework.SetPlayerMetadata(src, meta, value)
local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
xPlayer.setMeta(meta, value)
end

function Core.Framework.GetPlayerMetadata(src, meta)
local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
return xPlayer.getMeta(meta) or nil
end

function Core.Framework.AddSocietyBalance(job, amount)
local society = exports['esx_society']:GetSociety(job)
if not society then return end
TriggerEvent('esx_addonaccount:getSharedAccount', society.account, function(account)
account.addMoney(amount)
end)
end

function Core.Framework.RemoveSocietyBalance(job, amount)
local society = exports['esx_society']:GetSociety(job)
if not society then return end
TriggerEvent('esx_addonaccount:getSharedAccount', society.account, function(account)
account.removeMoney(amount)
end)
end

function Core.Framework.RegisterUsableItem(item, cb)
ESX.RegisterUsableItem(item, cb)
end

View file

@ -0,0 +1,39 @@
if GetResourceState('qb-core') ~= 'started' then return end
if GetResourceState('qbx_core') == 'started' then return end

Core.Info.Framework = 'QBCore'
local QBCore = exports['qb-core']:GetCoreObject()

Core.Framework = {}

function Core.Framework.Notify(message, type)
local resource = Cfg.Notification or 'default'
if resource == 'default' then
TriggerEvent('QBCore:Notify', message, 'primary', 3000)
elseif resource == 'ox' then
lib.notify({ description = message, type = type, position = 'top' })
elseif resource == 'custom' then
-- insert your notification export here
end
end

function Core.Framework.GetPlayerName()
local playerData = QBCore.Functions.GetPlayerData()
return playerData.charinfo.firstname, playerData.charinfo.lastname
end

function Core.Framework.ToggleOutfit(wear, outfits)
if wear then
local gender = QBCore.Functions.GetPlayerData().charinfo
local outfit = gender == 1 and outfits.Female or outfits.Male
if not outfit then return end
TriggerEvent('qb-clothing:client:loadOutfit', { outfitData = outfit })
else
TriggerServerEvent('qb-clothing:loadPlayerSkin')
end
end

function Core.Framework.GetPlayerMetadata(meta)
return QBCore.Functions.GetPlayerData().metadata[meta]
end

View file

@ -0,0 +1,99 @@
if GetResourceState('qb-core') ~= 'started' then return end
if GetResourceState('qbx_core') == 'started' then return end

Core.Info.Framework = 'QBCore'
local QBCore = exports['qb-core']:GetCoreObject()

Core.Framework = {}

function Core.Framework.Notify(src, message, type)
local src = src or source
local resource = Cfg.Notification
if resource == 'default' then
TriggerClientEvent('QBCore:Notify', src, message, type)
elseif resource == 'ox' then
TriggerClientEvent('ox_lib:notify', src, { description = message, type = type, position = 'top' })
elseif resource == 'custom' then
-- insert your notification export here
end
end

function Core.Framework.GetPlayerIdentifier(src)
local src = src or source
local playerData = QBCore.Functions.GetPlayer(src).PlayerData
if not playerData then return end
return playerData.citizenid
end

function Core.Framework.GetPlayerName(src)
local src = src or source
local playerData = QBCore.Functions.GetPlayer(src).PlayerData
if not playerData then return end
return playerData.charinfo.firstname, playerData.charinfo.lastname
end

function Core.Framework.GetPlayerJob(src)
local src = src or source
local playerData = QBCore.Functions.GetPlayer(src).PlayerData
if not playerData then return end
return playerData.job.name, playerData.job.label
end

function Core.Framework.GetPlayerJobGrade(src)
local src = src or source
local playerData = QBCore.Functions.GetPlayer(src).PlayerData
if not playerData then return end
return playerData.job.grade.level, playerData.job.grade.name
end

function Core.Framework.GetAccountBalance(src, account)
local src = src or source
local playerData = QBCore.Functions.GetPlayer(src).PlayerData
if not playerData then return end
if account == 'money' then account = 'cash' end
return playerData.money[account]
end

function Core.Framework.AddAccountBalance(src, account, amount)
local src = src or source
local player = QBCore.Functions.GetPlayer(src)
if not player then return end
if account == 'money' then account = 'cash' end
player.Functions.AddMoney(account, amount)
end

function Core.Framework.RemoveAccountBalance(src, account, amount)
local src = src or source
local player = QBCore.Functions.GetPlayer(src)
if not player then return end
if account == 'money' then account = 'cash' end
player.Functions.RemoveMoney(account, amount)
end

function Core.Framework.SetPlayerMetadata(src, meta, value)
local player = QBCore.Functions.GetPlayer(src)
if not player then return end
player.Functions.SetMetaData(meta, value)
end

function Core.Framework.GetPlayerMetadata(src, meta)
local player = QBCore.Functions.GetPlayer(src)
if not player then return end
return player.PlayerData.metadata[meta] or nil
end

function Core.Framework.AddSocietyBalance(job, amount)
local society = exports['qb-banking']:GetAccount(job)
if not society then return end
exports['qb-banking']:AddMoney(job, amount, 'cause qb')
end

function Core.Framework.RemoveSocietyBalance(job, amount)
local society = exports['qb-banking']:GetAccount(job)
if not society then return end
exports['qb-banking']:RemoveMoney(job, amount, 'cause qb')
end

function Core.Framework.RegisterUsableItem(item, cb)
QBCore.Functions.CreateUseableItem(item, cb)
end

View file

@ -0,0 +1,36 @@
if GetResourceState('qbx_core') ~= 'started' then return end

Core.Info.Framework = 'QBox'
local QBox = exports.qbx_core

Core.Framework = {}

function Core.Framework.Notify(message, type)
local resource = Cfg.Notification or 'default'
if resource == 'default' then
QBox:Notify(message, type)
elseif resource == 'ox' then
lib.notify({ description = message, type = type, position = 'top' })
elseif resource == 'custom' then
-- insert your notification export here
end
end

function Core.Framework.GetPlayerName()
return QBX.PlayerData.charinfo.firstname, QBX.PlayerData.charinfo.lastname
end

function Core.Framework.ToggleOutfit(wear, outfits)
if wear then
local gender = QBX.PlayerData.charinfo.gender
local outfit = gender == 1 and outfits.Female or outfits.Male
if not outfit then return end
TriggerEvent('qb-clothing:client:loadOutfit', { outfitData = outfit })
else
TriggerServerEvent('qb-clothing:loadPlayerSkin')
end
end

function Core.Framework.GetPlayerMetadata(meta)
return QBX.PlayerData.metadata[meta]
end

View file

@ -0,0 +1,98 @@
if GetResourceState('qbx_core') ~= 'started' then return end

Core.Info.Framework = 'QBox'
local QBox = exports.qbx_core

Core.Framework = {}

function Core.Framework.Notify(src, message, type)
local src = src or source
local resource = Cfg.Notification
if resource == 'default' then
QBox:Notify(src, message, type)
elseif resource == 'ox' then
TriggerClientEvent('ox_lib:notify', src, { description = message, type = type, position = 'top' })
elseif resource == 'custom' then
-- insert your notification export here
end
end

function Core.Framework.GetPlayerIdentifier(src)
local src = src or source
local playerData = QBox:GetPlayer(src).PlayerData
if not playerData then return end
return playerData.citizenid
end

function Core.Framework.GetPlayerName(src)
local src = src or source
local playerData = QBox:GetPlayer(src).PlayerData
if not playerData then return end
return playerData.charinfo.firstname, playerData.charinfo.lastname
end

function Core.Framework.GetPlayerJob(src)
local src = src or source
local playerData = QBox:GetPlayer(src).PlayerData
if not playerData then return end
return playerData.job.name, playerData.job.label
end

function Core.Framework.GetPlayerJobGrade(src)
local src = src or source
local playerData = QBox:GetPlayer(src).PlayerData
if not playerData then return end
return playerData.job.grade.level, playerData.job.grade.name
end

function Core.Framework.GetAccountBalance(src, account)
local src = src or source
local playerData = QBox:GetPlayer(src).PlayerData
if not playerData then return end
if account == 'money' then account = 'cash' end
return playerData.money[account]
end

function Core.Framework.AddAccountBalance(src, account, amount)
local src = src or source
local player = QBox:GetPlayer(src)
if not player then return end
if account == 'money' then account = 'cash' end
player.Functions.AddMoney(account, amount)
end

function Core.Framework.RemoveAccountBalance(src, account, amount)
local src = src or source
local player = QBox:GetPlayer(src)
if not player then return end
if account == 'money' then account = 'cash' end
player.Functions.RemoveMoney(account, amount)
end

function Core.Framework.SetPlayerMetadata(src, meta, value)
local player = QBox:GetPlayer(src)
if not player then return end
player.Functions.SetMetaData(meta, value)
end

function Core.Framework.GetPlayerMetadata(src, meta)
local player = QBox:GetPlayer(src)
if not player then return end
return player.PlayerData.metadata[meta] or nil
end

function Core.Framework.AddSocietyBalance(job, amount)
local society = exports['Renewed-Banking']:getAccountMoney(job)
if not society then return end
exports['Renewed-Banking']:addAccountMoney(job, amount)
end

function Core.Framework.RemoveSocietyBalance(job, amount)
local society = exports['Renewed-Banking']:getAccountMoney(job)
if not society then return end
exports['Renewed-Banking']:removeAccountMoney(job, amount)
end

function Core.Framework.RegisterUsableItem(item, cb)
QBox:CreateUseableItem(item, cb)
end