add: server filter maintenance

This commit is contained in:
Linventif 2024-02-27 23:55:44 +01:00
parent 09be85b49d
commit a634821f25
No known key found for this signature in database
GPG Key ID: FAC0CA60F9AEEC24
2 changed files with 28 additions and 15 deletions

View File

@ -63,6 +63,18 @@ local possibleConfig = {
-- end, -- end,
-- ["category"] = "Main" -- ["category"] = "Main"
-- }, -- },
["maintenance"] = {
["label"] = "Maintenance",
["description"] = "Activate or deactivate maintenance mode.",
["type"] = "checkbox",
["value"] = function(setting, value)
return value
end,
["onEdit"] = function(setting, value)
saveConfig(setting, value == "Enabled" && true || false)
end,
["category"] = "Main"
},
["filterOnBan"] = { ["filterOnBan"] = {
["label"] = "Block Discord Ban Player", ["label"] = "Block Discord Ban Player",
["description"] = "Block players banned on the discord server.", ["description"] = "Block players banned on the discord server.",

View File

@ -4,25 +4,19 @@
local function filterMessage(reason) local function filterMessage(reason)
local Message = { local Message = {
"", "\n----------------------------------------\n",
"This server has player filtering enabled", "You cannot join this server",
"You are not allowed to join this server",
"", "",
"Reason: " .. reason, "Reason: " .. reason,
"",
"For more information, please contact the server owner",
"Help URL: " .. (gmInte.config.supportLink && gmInte.config.supportLink || "No Support Link"), "Help URL: " .. (gmInte.config.supportLink && gmInte.config.supportLink || "No Support Link"),
"", "",
"You can also contact us on our discord server",
"https://gmod-integration.com/discord",
"",
"Have a nice day", "Have a nice day",
"", "\n----------------------------------------\n",
"Service provided by Gmod Integration", "Service provided by Gmod Integration",
} }
for k, v in pairs(Message) do for k, v in pairs(Message) do
Message[k] = v .. "\n" Message[k] = "\n" .. v
end end
return table.concat(Message) return table.concat(Message)
@ -58,18 +52,25 @@ local function playerFilter(data)
gmInte.http.get("/players/" .. data.steamID64, gmInte.http.get("/players/" .. data.steamID64,
function(code, body) function(code, body)
if (!body || !body.trust) then return end if (!gmInte.config.maintenance && !body.bypassMaintenance) then
game.KickID(data.networkid, filterMessage("The server is currently under maintenance and you are not whitelisted."))
end
if (!checkBanStatus(body.ban)) then if (!checkBanStatus(body.ban)) then
game.KickID(data.networkid, filterMessage("You are banned from this server")) game.KickID(data.networkid, filterMessage("You are banned from this server."))
end end
if (!checkDiscordBanStatus(body.discord_ban)) then if (!checkDiscordBanStatus(body.discord_ban)) then
game.KickID(data.networkid, filterMessage("You are banned from our discord server")) game.KickID(data.networkid, filterMessage("You are banned from our discord server."))
end end
if (!checkTrustFactor(body.trust)) then -- if (!checkTrustFactor(body.trust)) then
game.KickID(data.networkid, filterMessage("Your trust factor is too low")) -- game.KickID(data.networkid, filterMessage("Your trust factor is too low."))
-- end
end,
function (err)
if (!gmInte.config.maintenance) then
game.KickID(data.networkid, filterMessage("The server is currently under maintenance and we cannot verify your account.\nVerification URL: https://verif.gmod-integration.com"))
end end
end end
) )