From 51dc34b795a3ed7869711b286fe684214edcffcc Mon Sep 17 00:00:00 2001 From: DoopieWop <62191983+DoopieWop@users.noreply.github.com> Date: Wed, 7 Aug 2024 17:37:06 +0100 Subject: [PATCH] Fixed previous character ban preventing later checks from happening (#442) * Fixed previous character ban preventing later checks from happening In the CanPlayerUseCharacter hook, there is a check to make sure the character isnt banned. If the character received a temporary ban at some point and that ban runs out, the check in that function, returns, instead of letting later checks from happening, which could for instance let a character without a whitelist still load into a whitelisted character. --- gamemode/core/hooks/sh_hooks.lua | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/gamemode/core/hooks/sh_hooks.lua b/gamemode/core/hooks/sh_hooks.lua index 12342d9dd..41b045839 100644 --- a/gamemode/core/hooks/sh_hooks.lua +++ b/gamemode/core/hooks/sh_hooks.lua @@ -419,15 +419,13 @@ function GM:CanPlayerUseCharacter(client, character) local banned = character:GetData("banned") if (banned) then - if (isnumber(banned)) then - if (banned < os.time()) then - return - end - - return false, "@charBannedTemp" - end - - return false, "@charBanned" + if (!isnumber(banned)) then + return false, "@charBanned" + else + if (banned > os.time()) then + return false, "@charBannedTemp" + end + end end local bHasWhitelist = client:HasWhitelist(character:GetFaction())