From 3cc48b076719fbfaf5c9412d051686d0eb383405 Mon Sep 17 00:00:00 2001 From: BerkieBb <82737367+BerkieBb@users.noreply.github.com> Date: Tue, 1 Mar 2022 19:40:05 +0100 Subject: [PATCH] feat(server/functions): make isWhitelisted usable --- server/functions.lua | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/server/functions.lua b/server/functions.lua index f33e34a..a462c06 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -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