22 lines
722 B
Lua
22 lines
722 B
Lua
utils = include("sv_utils.lua")
|
|
config = include("sv_config.lua")
|
|
settings = include("sv_settings.lua")
|
|
|
|
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) |