settings = include("../sv_settings.lua") config = include("../sv_config.lua") util.AddNetworkString("get_diseases_name") util.AddNetworkString("get_players_data") util.AddNetworkString("infect") net.Receive("get_diseases_name", function (len, ply) local name_list = {} for i, disease in ipairs(settings.diseases) do table.insert(name_list, disease.name) end net.Start("get_diseases_name") net.WriteTable(name_list) net.Send(ply) end) net.Receive("get_players_data", function (len, ply) local files, _ = file.Find(config.save_path .. "*", "DATA") local data = {} for i, file_ in ipairs(files) do local ply_data = util.JSONToTable(file.Read(config.save_path .. file_)) local ret = {} local ply = player.GetBySteamID64(ply_data.SteamID64) if ply == false then ret.nick = ply_data.name else ret.nick = ply:Nick() end ret.SteamID64 = ply_data.SteamID64 table.insert(data, ret) end net.Start("get_players_data") net.WriteTable(data) net.Send(ply) end) net.Receive("infect", function (len, ply) local data = net.ReadTable() for _, infected in ipairs(data.infecteds) do for _, disease_name in ipairs(data.diseases) do print(disease_name) disease = settings.getDiseaseByName(disease_name) if (disease == nil) then print(ply:GetName() .. " try to add undifined disease") else print() disease:infect(infected, 1) end print("bozogang") end end end) print("bozo")