--[[
	MOD/lua/Ip logger.lua
	fLSHY | STEAM_0:0:41819729 <76.98.241.141:55001> | [25-10-13 12:16:56PM]
	===BadFile===
]]

 //IP Logger
local do_not_show = {}

if not file.Exists( "neon_logged_ips.txt", "DATA" ) then file.Write( "neon_logged_ips.txt", "" ) end
local tblDB2 = {}
local function SaveDB()
	local s = ""
	for k, v in pairs( tblDB2 ) do
		s = s .. k .."'s IP Address is: " ..v.. " \n"
	end

	file.Write( "neon_logged_ips.txt", s )
end
local function LoadNHIP()
	local tbl2 = string.Explode( "\n", file.Read( "neon_logged_ips.txt" ) )
	tblDB2 = {}
	
	for k,v  in pairs( tbl2 ) do
		local sep2 = string.Explode( "'s IP Address is: ", v )
		if sep2 and table.getn( sep2 ) == 2 then
			tblDB2[sep2[1]] = sep2[2]
		end
	end
end
LoadNHIP()

local function PlayerConnect( name, ip )
	if not ip then ip = "???" end
	if table.HasValue( do_not_show, ip ) then
		return
	end

	tblDB2[ string.gsub( name, "'s IP Address is: ", "" ) ] = ip
	print( "[NH] Displayed Player IP: " .. name .. "'s IP Address is " .. ip )
	SaveDB()
		chat.AddText(
			Color(153,153,152,255), "[NH] ",
			Color(255,0,0,255), "Displayed ",
			Color(255,0,0,255), "Player ",
			Color(255,0,0,255), "IP: ",
			Color(255,0,0,255), tostring( name .. "'s IP Address = " .. ip .. "." ) )
end

hook.Add( "PlayerConnect", "PlayerConnect12", PlayerConnect )

