PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Alexandros on 27 October, 2003, 02:42:44

Title: IP blocker
Post by: Alexandros on 27 October, 2003, 02:42:44
I need an script that don't let in an user if 3 users use the same IP...not 2..three.
And it would be good if it have a place to say what nicks don't need to be cheked...(if there are 2+ users in a lan with same public IP)

Thanks

Alex
Title:
Post by: BlazeXxX on 27 October, 2003, 15:56:45
Here is wat [NL]Pur Wrote/Gave for another request:

Try This one:

botname = "DoubleKick"
ip={}
oAllow={}

function Main()
oAllow["127.0.0.1"]=1 --Just an example;)
end

function NewUserConnected(user)
theIP=user.sIP
local a,b,c,d=splittip(theIP)
if ip[user.sIP] == nil then
ip[user.sIP]=user.sIP
elseif ((oAllow[a]==1)or(oAllow==1)or(oAllow[c]==1)or(oAllow[d]==1)) then
else
user:Kick("No doubles allowed!!!")
end
end

function UserDisconnected(user)
ip[user.sIP]=nil
end

function splittip(IP)
r,g,a,b,c,d = strfind(IP, "(%d*).(%d*).(%d*).(%d*)")
d=a.."."..b.."."..c.."."..d
c=a.."."..b.."."..c..".*"
b=a.."."..b..".*"
a=a..".*"
return a,b,c,d
end