feat(server/functions): make isWhitelisted usable

This commit is contained in:
BerkieBb
2022-03-01 19:40:05 +01:00
committed by GitHub
parent 0ba5d9cb40
commit 3cc48b0767
+4 -15
View File
@@ -225,7 +225,7 @@ end
-- Kick Player
function QBCore.Functions.Kick(source, reason, setKickReason, deferrals)
reason = '\n' .. reason .. '\n🔸 Check our Discord for further information: ' .. QBCore.Config.Server.discord
reason = '\n' .. reason .. '\n🔸 Check our Discord for further information: ' .. QBCore.Config.Server.Discord
if setKickReason then
setKickReason(reason)
end
@@ -254,22 +254,11 @@ function QBCore.Functions.Kick(source, reason, setKickReason, deferrals)
end)
end
-- Check if player is whitelisted (not used anywhere)
-- Check if player is whitelisted, kept like this for backwards compatibility or future plans
function QBCore.Functions.IsWhitelisted(source)
local plicense = QBCore.Functions.GetIdentifier(source, 'license')
local identifiers = GetPlayerIdentifiers(source)
if QBCore.Config.Server.whitelist then
local result = MySQL.Sync.fetchSingle('SELECT * FROM whitelist WHERE license = ?', { plicense })
if not result then return false end
for _, id in pairs(identifiers) do
if result.license == id then
return true
end
end
else
return true
end
if not QBCore.Config.Server.Whitelist then return true end
if QBCore.Functions.HasPermission(source, QBConfig.Server.WhitelistPermission) then return true end
return false
end