fix the config update

This commit is contained in:
Linventif 2023-09-23 02:24:45 +02:00
parent 0ccd2f3b1b
commit 7205dbe74a

View File

@ -15,14 +15,14 @@ gmInte.config = gmInte.config || {}
if (SERVER) then
RunConsoleCommand("sv_hibernate_think", "1")
if (file.Exists("gm_integration", "DATA") || !file.Exists("gm_integration/config.json", "DATA"))) then
if (!file.Exists("gm_integration", "DATA") || !file.Exists("gm_integration/config.json", "DATA")) then
file.CreateDir("gm_integration")
file.Write("gm_integration/config.json", util.TableToJSON(gmInte.config, true))
else
if (gmInte.config.id && gmInte.config.id != "") then return end
local oldConfig = util.JSONToTable(file.Read("gm_integration/config.json", "DATA"))
if (oldConfig.version < gmInte.version) then
if (!oldConfig.version || (oldConfig.version < gmInte.version)) then
gmInte.config = table.Merge(gmInte.config, oldConfig)
gmInte.config.version = gmInte.version
file.Write("gm_integration/config.json", util.TableToJSON(gmInte.config, true))
@ -84,4 +84,3 @@ print(" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ")
print(" ")
loadAllFiles("gmod_integration")
print(" ")
print(" ")