GMOD_disease/lua/autorun/server/sv_hook.lua

14 lines
461 B
Lua

config = include("../sh_config.lua")
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 default = {}
default.diseases = {}
file.Write(file_path, util.TableToJSON(default, true))
end
local data = file.Read(file_path)
ply.diseases = util.JSONToTable(data)
end)