
local Full = "http://37.59.174.140/games/admin/hexapi.php",
local Save = "hac_oh_db.txt"


function HAC.OH_RefreshDB(ply)
	if ply:IsBot() then return end
	
	local DoUpdate = false
	
	HTTP(
		{
			url		= Full
			method	= "get",
			
			success	= function(ret,Cont,head)
				if not Cont or (Cont == "") or (ret != 200) then
					ErrorNoHalt("[OH_RefreshDB] '"..Full.."' won't download: "..ret.."\n")
				else
					if file.Exists(Save, "DATA") then
						if file.Read(Save, "DATA") != Cont then
							DoUpdate = Cont
						end
					else
						DoUpdate = Cont
					end
					
					if DoUpdate then
						file.Write(Save, Cont)
					end
				end
			end,
			
			failed	= function(err)
				ErrorNoHalt("[OH_RefreshDB] '"..Full.."' won't download: "..err.."\n")
			end
		}
	)
	
	if DoUpdate then
		
	end
end
hook.Add("PlayerInitialSpawn", "HAC.OH_RefreshDB", HAC.OH_RefreshDB)


























