So i’m working on a ban system that stores all bans in a database but I am having trouble when it comes to the player joining and not being kicked for being banned.
I’m requesting the data from the database and checking if the ban is active or not and then trying to return true or false to the CheckPassword hook. Im not sure what is wrong. All help is appreciated
function checkBan(sid64)
local Check = db:query("SELECT * FROM bans WHERE SteamID64=".. sid64 .." AND Active=1")
function Check:onSuccess(data)
local row = data[1]
if row == nil then print("No data") return end
if row["Active"] ~= nil then
return true
end
end
function Check:onError(err)
print("An error occured while executing the query: " .. err)
end
Check:start()
end
hook.Add("CheckPassword", "bans_check", function(sid64)
if checkBan(sid64) then
return false, "You are banned"
end
end)