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,
-- ["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"] = {
["label"] = "Block Discord Ban Player",
["description"] = "Block players banned on the discord server.",

View File

@ -4,25 +4,19 @@
local function filterMessage(reason)
local Message = {
"",
"This server has player filtering enabled",
"You are not allowed to join this server",
"\n----------------------------------------\n",
"You cannot join this server",
"",
"Reason: " .. reason,
"",
"For more information, please contact the server owner",
"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",
"",
"\n----------------------------------------\n",
"Service provided by Gmod Integration",
}
for k, v in pairs(Message) do
Message[k] = v .. "\n"
Message[k] = "\n" .. v
end
return table.concat(Message)
@ -58,18 +52,25 @@ local function playerFilter(data)
gmInte.http.get("/players/" .. data.steamID64,
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
game.KickID(data.networkid, filterMessage("You are banned from this server"))
game.KickID(data.networkid, filterMessage("You are banned from this server."))
end
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
if (!checkTrustFactor(body.trust)) then
game.KickID(data.networkid, filterMessage("Your trust factor is too low"))
-- if (!checkTrustFactor(body.trust)) then
-- 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
)