PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: Maicom on 14 February, 2004, 01:24:29

Title: ip-bot redirecting help
Post by: Maicom on 14 February, 2004, 01:24:29
how i make this working.i dont want disconnect users i want redirect them if ip is not right

function NewUserConnected(curUser)
theIP=curUser.sIP
local a,b,c,d=splittip(theIP)
if ((oAllow[a]==1)or(oAllow==1)or(oAllow[c]==1)or(oAllow[d]==1)) then
else
curUser:SendPM(Bot,"Your IP/ISP isnt allowed here if you have a fast connection go to http:// ....")
curUser:Disconnect()
end
end


any help ?
Title:
Post by: nErBoS on 14 February, 2004, 01:50:24
Hi,

Use this...

addredirect = "1.1.1.1.1"

function NewUserConnected(curUser)
theIP=curUser.sIP
local a,b,c,d=splittip(theIP)
if ((oAllow[a]==1)or(oAllow[b]==1)or(oAllow[c]==1)or(oAllow[d]==1)) then
else
curUser:SendPM(Bot,"Your IP/ISP isnt allowed here if you have a fast connection go to [URL]http://[/URL] ....")
curUser:SendData("$ForceMove "..addredirect)
curUser:SendPM(Bot, "You are been redirected...")
end
end

Best regrads, nErBoS
Title:
Post by: Maicom on 14 February, 2004, 02:05:51
Syntax Error: attempt to concat global `addredirect' (a nil value)
not working

-- Ipbot lua script by aMutex --
Bot = "IPBot"
oAllow={}
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

function Main()
frmHub:RegBot(Bot)
oAllow["130.234.*"]=1
oAllow["130.233.*"]=1
end
function NewUserConnected(curUser)
theIP=curUser.sIP
local a,b,c,d=splittip(theIP)
if ((oAllow[a]==1)or(oAllow==1)or(oAllow[c]==1)or(oAllow[d]==1)) then
else
curUser:SendPM(Bot,"Your IP/ISP isnt allowed here if you have a fast connection go to //http:// ....")
curUser:SendData("$ForceMove "..addredirect)
curUser:SendPM(Bot, "You are been redirected...")
end
end
Title:
Post by: Maicom on 19 March, 2004, 18:31:09
sorry nErBoS and big THANKS to you this is working  :))