GMOD_disease/lua/autorun/server/sv_saves.lua

21 lines
684 B
Lua
Raw Normal View History

2023-09-03 15:40:13 -04:00
utils = include("sv_utils.lua")
config = include("sv_config.lua")
2023-09-03 15:40:13 -04:00
utils.path_create(config.save_path .. "/ss")
hook.Add("PlayerInitialSpawn", "reAddDisease", function (ply)
local file_path = config.save_path .. ply:SteamID64() .. ".json"
print(file_path)
if not file.Exists(file_path, "DATA")
then
local data = {}
data.diseases = {}
data.SteamID64 = ply:SteamID64()
data.name = ply:Nick()
file.Write(file_path, util.TableToJSON(data, true))
end
local data = util.JSONToTable(file.Read(file_path))
data.name = ply:Nick()
file.Write(file_path, util.TableToJSON(data, true))
ply.diseases = data.diseases
end)