-- Script by JetBoom

PlayerIP = {}
for i=1, _MaxPlayers() do
PlayerIP[i] = "0.0.0.0"
end
PendingName = {}

function IPGet(name, address, steamid)
	PendingName[name] = address
end
HookEvent("eventPlayerConnect", IPGet)

function IPSet(name, userid, steamid)
	--local a = string.find(PendingName[name], ":")
	--PlayerIP[userid] = string.sub(PendingName[name], 1, a-1)
	PlayerIP[userid] = PendingName[name]
	PendingName[name] = nil
end
HookEvent("eventPlayerActive", IPSet)

function IPRemove(name, userid, address, steamid, reason)
	PlayerIP[userid] = "0.0.0.0"
end
HookEvent("eventPlayerDisconnect", IPRemove)

function IPAddress(userid) return PlayerIP[userid] end
