--------------------------------------------------------------------
BotName = frmHub:GetHubBotName()
----------------------------------------------------------------------------------------------
GuardianFile = "Guard/Guarding.P2P"
Guard = {}
Guardian = 1
----------------------------------------------------------------------------------------------
--//Code
----------------------------------------------------------------------------------------------
function Main()
LoadGuard(Guard,GuardianFile)
frmHub:RegBot(BotName)
end
----------------------------------------------------------------------------------------------
function NewUserConnected(User)
if GuardianCheck==1 then
local check,comp = BlockGuard(User.sIP)
if check==1 then
SendPmToOps(nBotName,"*** "..User.sName.." - ( "..User.sIP.." ) from Company ( "..comp.." ) tried to login! ***")
check = 0
end
end
end
----------------------------------------------------------------------------------------------
function BlockGuard(ip)
local _,_,a,b,c,d = strfind(ip, "(%d*).(%d*).(%d*).(%d*)")
if ( tonumber(a) and tonumber(b) and tonumber(c) and tonumber(d) ) then
local uip = ComputeIP(ip)
if uip then
for range,comp in Guard do
local _,_,r1,r2 = strfind(range, "(.*)-(.*)")
r1 = ComputeIP(r1)
r2 = ComputeIP(r2)
if uip>=r1 and uip<=r2 then
return 1,comp
end
end
end
end
end
----------------------------------------------------------------------------------------------
function ComputeIP(curIP)
local _,_,a,b,c,d = strfind(curIP, "(%d+).(%d+).(%d+).(%d+)")
return a*16777216 + b*65536 + c*256 + d
end
----------------------------------------------------------------------------------------------
function LoadGuard(table,file)
local handle = openfile(file, "r")
if (handle) then
local line = read(handle)
while line do
s,e,ind,val = strfind( line, "(.*):(.*)")
table[val]=ind
line = read(handle)
end
closefile(handle)
end
end
About that script, im added a Guard/Guarding.p2p
in that folder, but getting this error:
Syntax error: table index is nil
stack traceback:
1: function `LoadGuard' at line 53 [file `H:\FPS Ptokax\scripts\guard.lua']
2: function `Main' at line 11 [file `H:\FPS Ptokax\scripts\guard.lua']
Anyone knows how to solve that problem?
Well, m8, use peerguardian lite or blockpost for outpost, don't use this script for antip2p, it just blocks ppl connecting 2 ur hub.
I have almost the same problem with my homemade anti media force bot. Syntax error: table index is nil
stack traceback:
1: function `LoadGuard' at line is the problem my bot have. I`ll continue to try to solve it and let you know if I get it solved.