diff --git a/lua/gmod_integration/client/cl__color.lua b/lua/gmod_integration/client/cl__color.lua index 083b933..bb25a43 100644 --- a/lua/gmod_integration/client/cl__color.lua +++ b/lua/gmod_integration/client/cl__color.lua @@ -45,5 +45,5 @@ function gmInte.applyPaint(element, id) end function gmInte.getFrameName(name) - return "Gmod Integration v" .. gmInte.config.version .. " - " .. name + return "Gmod Integration v" .. (gmInte.version || "0.0.0") .. " - " .. name end \ No newline at end of file diff --git a/lua/gmod_integration/client/cl_gui_admin.lua b/lua/gmod_integration/client/cl_gui_admin.lua index 376618e..5ac2b76 100644 --- a/lua/gmod_integration/client/cl_gui_admin.lua +++ b/lua/gmod_integration/client/cl_gui_admin.lua @@ -355,6 +355,9 @@ end function gmInte.openConfigMenu(data) local needRestart = false + if (gmInte.openAdminPanel) then return end + gmInte.openAdminPanel = true + local frame = vgui.Create("DFrame") frame:SetSize(400, (600 / 1080) * ScrH()) frame:Center() @@ -507,6 +510,7 @@ function gmInte.openConfigMenu(data) end frame.OnClose = function() + gmInte.openAdminPanel = false if (needRestart) then gmInte.needRestart() end end end @@ -515,5 +519,5 @@ end // Concommands // -concommand.Add("gmod_integration_admin", gmInte.openAdminConfig) -concommand.Add("gmi_admin", gmInte.openAdminConfig) \ No newline at end of file +concommand.Add("gmod_integration_admin", function() gmInte.SendNet("getConfig") end) +concommand.Add("gmi_admin", function() gmInte.SendNet("getConfig") end) \ No newline at end of file diff --git a/lua/gmod_integration/client/cl_net.lua b/lua/gmod_integration/client/cl_net.lua index 214f047..8f85484 100644 --- a/lua/gmod_integration/client/cl_net.lua +++ b/lua/gmod_integration/client/cl_net.lua @@ -36,6 +36,7 @@ local netReceive = { end, [5] = function(data) gmInte.config = table.Merge(gmInte.config, data.config) + gmInte.version = data.other.version if (!data.other.aprovedCredentials) then RunConsoleCommand("gmod_integration_admin") end end, [6] = function(data) diff --git a/lua/gmod_integration/server/sv_settings.lua b/lua/gmod_integration/server/sv_settings.lua index 8ed3e0d..67a2bae 100644 --- a/lua/gmod_integration/server/sv_settings.lua +++ b/lua/gmod_integration/server/sv_settings.lua @@ -15,10 +15,10 @@ function gmInte.saveSetting(setting, value) file.Write("gm_integration/config.json", util.TableToJSON(gmInte.config, true)) gmInte.log("Setting Saved") - // send to all players if it's a public setting + // send to all players the new public config for _, ply in pairs(player.GetAll()) do if (ply:IsValid() && ply:IsPlayer(ply)) then - gmInte.log("Sending new Public Config to " .. ply:Nick()) + gmInte.log("Sending new Public Config to " .. ply:Nick(), true) gmInte.publicGetConfig(ply) end end @@ -69,10 +69,10 @@ function gmInte.publicGetConfig(ply) ["debug"] = gmInte.config.debug, ["apiFQDN"] = gmInte.config.apiFQDN, ["websocketFQDN"] = gmInte.config.websocketFQDN, - ["version"] = gmInte.config.version, }, ["other"] = { ["aprovedCredentials"] = gmInte.aprovedCredentials, + ["version"] = gmInte.version, } }, ply) end diff --git a/lua/gmod_integration/shared/sh_http.lua b/lua/gmod_integration/shared/sh_http.lua index cd6f6ce..bb31cad 100644 --- a/lua/gmod_integration/shared/sh_http.lua +++ b/lua/gmod_integration/shared/sh_http.lua @@ -33,7 +33,7 @@ function gmInte.http.requestAPI(params) local method = params.method || "GET" local success = params.success || function() end local failed = params.failed || function() end - local version = gmInte.config.version || "Unknown" + local version = gmInte.version || "Unknown" local showableBody = showableBody(params.endpoint) local localRequestID = util.CRC(tostring(SysTime()))