Код
tAllowedRanges = { -- диапазоны IP, которым разрешен поиск и скачка
["10.0.0.0"]= "10.255.255.255",
["192.168.0.0"]= "192.168.255.255",
}
tTemp = {}
function OnStartup()
for a,b in pairs(tAllowedRanges) do
tTemp[(computeIP(a))] = computeIP(b)
end
end
function ConnectToMeArrival(user)
Core.GetUserData(user,16)
if not checkIP(user.sIP) then
return true
end
end
RevConnectToMeArrival,SearchArrival = ConnectToMeArrival,ConnectToMeArrival
function checkIP(sIP)
local iIP = computeIP(sIP)
if iIP then
for startRange,endRange in pairs(tTemp) do
if (iIP >= startRange)and (iIP <= endRange) then
return true
end
end
end
end
function computeIP(sIP)
local _,_,a,b,c,d = string.find(sIP, "(%d+).(%d+).(%d+).(%d+)")
return a*16777216 + b*65536 + c*256 + d
end