2023-09-03 15:40:13 -04:00
|
|
|
utils = include("sv_utils.lua")
|
2023-09-06 10:49:26 -04:00
|
|
|
config = include("sv_config.lua")
|
2023-09-03 15:40:13 -04:00
|
|
|
|
2023-09-06 10:49:26 -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)
|