GMOD_disease/lua/autorun/server/sv_hook.lua

14 lines
461 B
Lua
Raw Normal View History

2023-09-03 15:40:13 -04:00
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)