Skip to content

Commit

Permalink
Fixed previous character ban preventing later checks from happening (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
DoopieWop committed Aug 7, 2024
1 parent 843391d commit 51dc34b
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions gamemode/core/hooks/sh_hooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 51dc34b

Please sign in to comment.