95 lines
2.7 KiB
Lua
95 lines
2.7 KiB
Lua
if Config.JobCheck.ESX.Enabled then
|
|
ESX = exports["es_extended"]:getSharedObject()
|
|
end
|
|
|
|
if Config.JobCheck.vRP.Enabled then
|
|
local Tunnel = module("vrp", "lib/Tunnel")
|
|
local Proxy = module("vrp", "lib/Proxy")
|
|
vRP = Proxy.getInterface("vRP")
|
|
vRPclient = Tunnel.getInterface("vRP","vRP")
|
|
end
|
|
|
|
if Config.JobCheck.QBCore.Enabled then
|
|
QBCore = exports['qb-core']:GetCoreObject()
|
|
end
|
|
|
|
function UserHasPermission(source, location)
|
|
|
|
if not location.EnablePermissions then
|
|
return true
|
|
end
|
|
|
|
if location.AcePermissions.Enabled then
|
|
if location.AcePermissions.Permission ~= nil then
|
|
if IsPlayerAceAllowed(source, location.AcePermissions.Permission) then
|
|
return true
|
|
end
|
|
else
|
|
return true
|
|
end
|
|
end
|
|
|
|
-- ESX Permissions
|
|
if location.ESX.Enabled then
|
|
local xPlayer = ESX.GetPlayerFromId(source)
|
|
if location.ESX.CheckJob.Enabled then
|
|
for k, v in pairs(location.ESX.CheckJob.Jobs) do
|
|
if xPlayer.job.name == v then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- vRP Permission
|
|
if location.vRP.Enabled then
|
|
if location.vRP.CheckPermission.Enabled then
|
|
for k, v in pairs(location.vRP.CheckPermission.Permissions) do
|
|
if vRP.hasPermission({vRP.getUserId({source}),v}) then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
|
|
if location.vRP.CheckGroup.Enabled then
|
|
for k, v in pairs(location.vRP.CheckGroup.Groups) do
|
|
if vRP.hasGroup({vRP.getUserId({source}),v}) then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- QBCore Permission
|
|
if location.QBCore.Enabled then
|
|
local player = QBCore.Functions.GetPlayer(source)
|
|
if location.QBCore.CheckJob.Enabled then
|
|
for k, v in pairs(location.QBCore.CheckJob.Jobs) do
|
|
if player.PlayerData.job.name == v then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
if location.QBCore.CheckPermission.Enabled then
|
|
for k, v in pairs(location.QBCore.CheckPermission.permissions) do
|
|
if QBCore.Functions.HasPermission(source, v) then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
if location.QBX.Enabled then
|
|
local player = exports.qbx_core:GetPlayer(source)
|
|
if location.QBX.CheckJob.Enabled then
|
|
for k, v in pairs(location.QBX.CheckJob.Jobs) do
|
|
if player.PlayerData.job.name == v then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
return false
|
|
end
|