diff --git a/lua/gmod_integration/client/cl_main.lua b/lua/gmod_integration/client/cl_main.lua index c13443d..7c37061 100644 --- a/lua/gmod_integration/client/cl_main.lua +++ b/lua/gmod_integration/client/cl_main.lua @@ -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 diff --git a/lua/gmod_integration/server/sv_con.lua b/lua/gmod_integration/server/sv_con.lua index 9ebe4f4..07289c3 100644 --- a/lua/gmod_integration/server/sv_con.lua +++ b/lua/gmod_integration/server/sv_con.lua @@ -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 diff --git a/lua/gmod_integration/server/sv_net.lua b/lua/gmod_integration/server/sv_net.lua index 4ff56c7..d4be3c1 100644 --- a/lua/gmod_integration/server/sv_net.lua +++ b/lua/gmod_integration/server/sv_net.lua @@ -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, diff --git a/lua/gmod_integration/server/sv_settings.lua b/lua/gmod_integration/server/sv_settings.lua index 41f5df5..6b79d62 100644 --- a/lua/gmod_integration/server/sv_settings.lua +++ b/lua/gmod_integration/server/sv_settings.lua @@ -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 diff --git a/lua/gmod_integration/shared/sh_player_meta.lua b/lua/gmod_integration/shared/sh_player_meta.lua index 9854e22..0e18802 100644 --- a/lua/gmod_integration/shared/sh_player_meta.lua +++ b/lua/gmod_integration/shared/sh_player_meta.lua @@ -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 diff --git a/lua/gmod_integration/sv_config.lua b/lua/gmod_integration/sv_config.lua index 1470f91..e912aeb 100644 --- a/lua/gmod_integration/sv_config.lua +++ b/lua/gmod_integration/sv_config.lua @@ -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 \ No newline at end of file +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, +} \ No newline at end of file