This commit is contained in:
Nordi98 2025-06-12 03:59:16 +02:00
parent 453b281a4b
commit 46b895aff2
25 changed files with 716 additions and 0 deletions

View file

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

ESX = exports.es_extended:getSharedObject()

function ShowNotification(text)
ESX.ShowNotification(text)
end

function ShowHelpNotification(text)
ESX.ShowHelpNotification(text)
end

function ServerCallback(name, cb, ...)
ESX.TriggerServerCallback(name, cb, ...)
end

function GetPlayersInArea(coords, maxDistance)
return ESX.Game.GetPlayersInArea(coords, maxDistance)
end

function CanAccessGroup(data)
if not data then return true end
local pdata = ESX.GetPlayerData()
for k,v in pairs(data) do
if (pdata.job.name == k and pdata.job.grade >= v) then return true end
end
return false
end

RegisterNetEvent(GetCurrentResourceName()..":showNotification", function(text)
ShowNotification(text)
end)

View file

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

ESX = exports.es_extended:getSharedObject()

function RegisterCallback(name, cb)
ESX.RegisterServerCallback(name, cb)
end

function RegisterUsableItem(...)
ESX.RegisterUsableItem(...)
end

function ShowNotification(target, text)
TriggerClientEvent(GetCurrentResourceName()..":showNotification", target, text)
end

function Search(source, name)
local xPlayer = ESX.GetPlayerFromId(source)
if (name == "money") then
return xPlayer.getMoney()
elseif (name == "bank") then
return xPlayer.getAccount('bank').money
else
local item = xPlayer.getInventoryItem(name)
if item ~= nil then
return item.count
else
return 0
end
end
end

function AddItem(source, name, amount)
local xPlayer = ESX.GetPlayerFromId(source)
if (name == "money") then
return xPlayer.addMoney(amount)
elseif (name == "bank") then
return xPlayer.addAccountMoney('bank', amount)
else
return xPlayer.addInventoryItem(name, amount)
end
end

function RemoveItem(source, name, amount)
local xPlayer = ESX.GetPlayerFromId(source)
if (name == "money") then
return xPlayer.removeMoney(amount)
elseif (name == "bank") then
return xPlayer.removeAccountMoney('bank', amount)
else
return xPlayer.removeInventoryItem(name, amount)
end
end

function CanAccessGroup(source, data)
if not data then return true end
local pdata = ESX.GetPlayerFromId(source)
for k,v in pairs(data) do
if (pdata.job.name == k and pdata.job.grade >= v) then return true end
end
return false
end

function GetIdentifier(source)
local xPlayer = ESX.GetPlayerFromId(source)
return xPlayer.identifier
end

View file

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

QBCore = exports['qb-core']:GetCoreObject()

function ServerCallback(name, cb, ...)
QBCore.Functions.TriggerCallback(name, cb, ...)
end

function ShowNotification(text)
QBCore.Functions.Notify(text)
end

function ShowHelpNotification(text)
AddTextEntry('qbHelpNotification', text)
BeginTextCommandDisplayHelp('qbHelpNotification')
EndTextCommandDisplayHelp(0, false, false, -1)
end

function GetPlayersInArea(coords, maxDistance)
return QBCore.Functions.GetPlayersFromCoords(coords, maxDistance)
end

function CanAccessGroup(data)
if not data then return true end
local pdata = QBCore.Functions.GetPlayerData()
for k,v in pairs(data) do
if (pdata.job.name == k and pdata.job.grade.level >= v) then return true end
end
return false
end

RegisterNetEvent(GetCurrentResourceName()..":showNotification", function(text)
ShowNotification(text)
end)

View file

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

QBCore = exports['qb-core']:GetCoreObject()

function RegisterCallback(name, cb)
QBCore.Functions.CreateCallback(name, cb)
end

function RegisterUsableItem(...)
QBCore.Functions.CreateUseableItem(...)
end

function ShowNotification(target, text)
TriggerClientEvent(GetCurrentResourceName()..":showNotification", target, text)
end

function Search(source, name)
local xPlayer = QBCore.Functions.GetPlayer(source)
if (name == "money") then
return xPlayer.PlayerData.money['cash']
elseif (name == "bank") then
return xPlayer.PlayerData.money['cash'] -- If anyone knows how to get bank balance for QBCore, let me know.
else
local item = xPlayer.Functions.GetItemByName(name)
if item ~= nil then
return item.amount
else
return 0
end
end
end

function AddItem(source, name, amount)
local xPlayer = QBCore.Functions.GetPlayer(source)
if (name == "money") then
return xPlayer.Functions.AddMoney("cash", amount)
elseif (name == "bank") then
return xPlayer.Functions.AddMoney("cash", amount) -- If anyone knows how to add to bank balance for QBCore, let me know.
else
return xPlayer.Functions.AddItem(name, amount)
end
end

function RemoveItem(source, name, amount)
local xPlayer = QBCore.Functions.GetPlayer(source)
if (name == "money") then
return xPlayer.Functions.RemoveMoney("cash", amount)
elseif (name == "bank") then
return xPlayer.Functions.RemoveMoney("cash", amount) -- If anyone knows how to remove from bank balance for QBCore, let me know.
else
return xPlayer.Functions.RemoveItem(name, amount)
end
end

function CanAccessGroup(source, data)
if not data then return true end
local pdata = QBCore.Functions.GetPlayer(source).PlayerData
for k,v in pairs(data) do
if (pdata.job.name == k and pdata.job.grade.level >= v) then return true end
end
return false
end

function GetIdentifier(source)
local xPlayer = QBCore.Functions.GetPlayer(source).PlayerData
return xPlayer.citizenid
end

View file

@ -0,0 +1,4 @@
if GetResourceState('es_extended') == 'started' then return end
if GetResourceState('qb-core') == 'started' then return end

print("You are not using a supported framework, it will be required to make edits to the bridge files.")

View file

@ -0,0 +1,4 @@
if GetResourceState('es_extended') == 'started' then return end
if GetResourceState('qb-core') == 'started' then return end

print("You are not using a supported framework, it will be required to make edits to the bridge files.")