Hi, can someone take a look at this ip-share bot and tell me if what could make it better. I love this bot but it?s old and many ppl have been changeing it so it needs a facelift hehe. most PotkaX hubs in Iceland use this bot so plz help.
Bot = "IP-BOT"
IPrange = {
["157.157.0.0/16"] = "S?mnet",
["157.157.139.0/24"] = "S?mnet",
["192.147.34.0/24"] = "S?mnet",
["193.4.58.0/23"] = "S?mnet (ISNIC)",
["194.105.224.0/19"] = "S?mnet (P&S)",
["212.30.192.0/19"] = "S?mnet",
["213.167.128.0/19"] = "S?mnet",
["62.145.128.0/19"] = "Lina.Net",
["81.15.0.0/17"] = "Lina.Net",
["213.220.64.0/18"] = "Lina.Net",
["82.112.64.0/19"] = "OGvodafone (R??h?s Rvk)",
["193.4.0.0/16"] = "OGvodafone",
["194.144.0.0/16"] = "OGvodafone",
["213.176.128.0/19"] = "OGvodafone",
["213.213.128.0/19"] = "OGvodafone",
["217.9.128.0/20"] = "OGvodafone",
["83.173.0.0/18"] = "Orkuveita Reykjavikur",
["213.220.124.0/18"] = "Fj?ltengi (Orkuveitunar)",
["130.208.0.0/16"] = "RHNet (Ranns?kna og h?sk?laneti?)",
["82.148.64.0/19"] = "FSNet (Sk?lanet)",
["212.126.224.0/19"] = "deCode Genetics inc",
["213.181.96.0/19"] = "Netsamskipti ehf",
["217.151.160.0/19"] = "Margmi?lun",
["213.190.96.0/19"] = "Hringidan ehf.",
["193.109.16.0/20"] = "Snerpa",
["217.28.176.0/20"] = "Skyggnir hf.",
["82.221.0.0/16"] = "Sk?rr hf.",
}
fast = {}
fastISP = {}
function splittip(IP)
r,g,a,b,c,d = strfind(IP, "(%d*).(%d*).(%d*).(%d*)")
return ((a*256+b)*256+c)*256+d
end
function splittrange(IP)
r,g,a,b,c,d,bits = strfind(IP, "(%d*).(%d*).(%d*).(%d*)/(%d*)")
ipnumber = ((a*256+b)*256+c)*256+d
return ipnumber, (ipnumber + (2^(32-bits)) - 1)
end
function testIP(theIP, curUser)
local ipnum=splittip(theIP)
local testok = false
local range = 0
local line = read()
for key,value in fast do
if((ipnum >= key) and (ipnum <= value)) then
testok = 1
range = key
break
end
end
if(testok) then
SendToNick(curUser.sName, " -<>===================< IP-BOT >=================<>- ")
SendToNick(curUser.sName, "\tWelcome........................................... " ..curUser.sName)
SendToNick(curUser.sName, "\tYou are connected through........... "..fastISP[range])
SendToNick(curUser.sName, "\tYour IP is:.......................................... "..theIP)
SendToNick(curUser.sName, "\tCountry:.............................................. ?sland")
i,j,temp = strfind(curUser.sMyInfoString, "$(%d+)%$")
if temp == nil then
curUser:Disconnect()
return
end
userShare = format("%0.2f", tonumber(temp)/gb)
SendToNick(curUser.sName, "\tYou are shareing............................. "..userShare.." GB ")
SendToNick(curUser.sName, " -<>=============================================<>- ")
SendToNick(curUser.sName, " ")
if tonumber(temp) > maxShare then
SendToNick(curUser.sName, "You have too much share, max share is "..maxShare/gb.." GB")
SendToNick(curUser.sName, "Please fix that, and come back")
curUser:Disconnect()
end
if tonumber(temp) < minShare then
SendToNick(curUser.sName, "You have not reached the min share, min share is "..minShare/gb.." GB")
SendToNick(curUser.sName, "You are welcome back when you have reached that")
curUser:Disconnect()
end
else
SendToNick(curUser.sName, "Foreign IP, This hub is for Icelandic IP?s only :S....but if it is icelandic please form the admin about it at (cyberpimp@internet.is) and include your IP address")
curUser:Disconnect()
end
end
gb = 1024*1024*1024
maxShare = 2*1024 * gb
minShare = gb/2
function Main()
frmHub:RegBot(Bot)
for k,v in IPrange do
startip,endip = splittrange(k)
-- print(startip.." <= ip <= "..endip)
fast[startip] = endip
fastISP[startip] = v
end
end
function NewUserConnected(curUser)
theIP=curUser.sIP
testIP(theIP, curUser)
end
Can someone help me to put profile af the login user.
And if you see anything that could be made better plz post it.