Skip to content

Commit

Permalink
fix(server/functions): ban checking edge case (#519)
Browse files Browse the repository at this point in the history
  • Loading branch information
mafewtm authored Jul 24, 2024
1 parent eccd3b4 commit 6ff85eb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion server/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,18 @@ exports('ToggleOptin', ToggleOptin)
---@return boolean
---@return string? playerMessage
function IsPlayerBanned(source)
local plicense = GetPlayerIdentifierByType(source --[[@as string]], 'license2') or GetPlayerIdentifierByType(source --[[@as string]], 'license')
local plicense = GetPlayerIdentifierByType(source --[[@as string]], 'license2')
local result = storage.fetchBan({
license = plicense
})

if not result then
plicense = GetPlayerIdentifierByType(source --[[@as string]], 'license')
result = storage.fetchBan({
license = plicense
})
end

if not result then return false end
if os.time() < result.expire then
local timeTable = os.date('*t', tonumber(result.expire))
Expand Down

0 comments on commit 6ff85eb

Please sign in to comment.