add: ply:gmIntIsAdmin()

This commit is contained in:
Linventif 2024-08-09 16:35:20 +00:00
parent efa2821a70
commit 77f21a6131
6 changed files with 17 additions and 10 deletions

View File

@ -17,7 +17,7 @@ function gmInte.showTestConnection(data)
end
function gmInte.openAdminConfig()
if !LocalPlayer():IsSuperAdmin() then
if !ply:gmIntIsAdmin() then
chat.AddText(Color(255, 130, 92), "[Gmod Integration] ", Color(102, 63, 63), "You are not superadmin")
return
end

View File

@ -8,7 +8,7 @@ local conFuncs = {
}
local function cmdExecuted(ply, cmd, args)
if ply:IsPlayer() && !ply:IsSuperAdmin() then return end
if ply:IsPlayer() && !ply:gmIntIsAdmin() then return end
if conFuncs[args[1]] then
conFuncs[args[1]](args)
else

View File

@ -30,7 +30,7 @@ local netReceive = {
[3] = function(ply, data) gmInte.superadminSetConfig(ply, data) end,
[4] = function(ply) gmInte.takeScreenshot(ply) end,
[5] = function(ply)
if !ply:IsSuperAdmin() then return end
if !ply:gmIntIsAdmin() then return end
RunConsoleCommand("changelevel", game.GetMap())
end,
[6] = function(ply) gmInte.verifyPlayer(ply) end,

View File

@ -43,7 +43,7 @@ function gmInte.refreshSettings()
end
function gmInte.superadminGetConfig(ply)
if !ply:IsValid() || !ply:IsPlayer(ply) || !ply:IsSuperAdmin() then return end
if !ply:IsValid() || !ply:IsPlayer(ply) || !ply:gmIntIsAdmin() then return end
gmInte.config.websocket = GWSockets && true || false
gmInte.SendNet("adminConfig", gmInte.config, ply)
end
@ -65,7 +65,7 @@ function gmInte.publicGetConfig(ply)
end
function gmInte.superadminSetConfig(ply, data)
if !ply:IsValid() || !ply:IsPlayer(ply) || !ply:IsSuperAdmin() then return end
if !ply:IsValid() || !ply:IsPlayer(ply) || !ply:gmIntIsAdmin() then return end
for k, v in pairs(data) do
gmInte.saveSetting(k, v)
end

View File

@ -12,6 +12,10 @@ function ply:gmIntSetCustomValue(key, value)
self.gmIntCustomValues[key] = value
end
function ply:gmIntIsAdmin()
return gmInte.config.adminRank[self:GetUserGroup()] || false
end
function ply:gmIntGetCustomValue(key)
return self.gmIntCustomValues && self.gmIntCustomValues[key]
end

View File

@ -18,10 +18,6 @@ gmInte.config.id = "" // Server ID
gmInte.config.token = "" // Server Token
gmInte.config.websocketFQDN = "ws.gmod-integration.com" // The FQDN of the websocket server
gmInte.config.apiFQDN = "api.gmod-integration.com" // The FQDN of the API server
// Other
gmInte.config.forcePlayerLink = false // If true, the addon will force the players to link their discord account to their steam account before playing
gmInte.config.supportLink = "" // The link of your support (shown when a player do not have the requiments to join the server)
gmInte.config.maintenance = false // If true, the addon will only allow the players with the "gmod-integration.maintenance" permission to join the server
// Punishment
gmInte.config.syncBan = true // If true, the addon will sync gmod bans with discord bans (and vice versa)
gmInte.config.syncTimeout = false // If true, the addon will sync gmod timeouts with discord timeouts (and vice versa)
@ -31,4 +27,11 @@ gmInte.config.filterOnBan = true // If true, the addon will filter the players a
// Materials
gmInte.config.redownloadMaterials = false // If true, the addon will redownload the materials of the addon (useful if you have a problem with the materials)
// Debug & Development
gmInte.config.debug = false // If true, the addon will show debug informations in the console
gmInte.config.debug = false // If true, the addon will show debug informations in the console// Other
// Other
gmInte.config.forcePlayerLink = false // If true, the addon will force the players to link their discord account to their steam account before playing
gmInte.config.supportLink = "" // The link of your support (shown when a player do not have the requiments to join the server)
gmInte.config.maintenance = false // If true, the addon will only allow the players with the "gmod-integration.maintenance" permission to join the server
gmInte.config.adminRank = {
["superadmin"] = true,
}