Bot = "School-Check"
function Main()
frmHub:RegBot(Bot)
end
function NewUserConnected(user, data)
local s,e,a,b,c,d = strfind(user.sIP, "(%d+).(%d+).(%d+).(%d+)")
if ("169.232." == a.."."..b..".") then
if not (strsub(user.sName,1,6) == "[ucla]" or strsub(user.sName,1,6)=="[UCLA]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
end
elseif ("128.54." == a.."."..b..".") then
if not (strsub(user.sName,1,6) == "[ucsd]" or strsub(user.sName,1,6)=="[UCSD]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
end
elseif ("169.229." == a.."."..b..".") then
if not (strsub(user.sName,1,6) == "[ucb]" or strsub(user.sName,1,6)=="[UCB]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
end
elseif ("128.155." == a.."."..b..".") then
if not (strsub(user.sName,1,6) == "[usc]" or strsub(user.sName,1,6)=="[USC]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
end
elseif ("169.233." == a.."."..b..".") then
if not (strsub(user.sName,1,6) == "[ucsc]" or strsub(user.sName,1,6)=="[UCSC]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
end
elseif ("120." == a..".") then
if not (strsub(user.sName,1,6) == "[usd]" or strsub(user.sName,1,6)=="[USD]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
end
end
end
What additional script would I have to add to make this bot BAN people whose IP address don't match their nickname. Also, how come the bot would 'speak up' when sometimes an IP address matches the nickname format?
Hi,
Hope it helps..
Bot = "School-Check"
function Main()
frmHub:RegBot(Bot)
end
function NewUserConnected(user, data)
local s,e,a,b,c,d = strfind(user.sIP, "(%d+).(%d+).(%d+).(%d+)")
if ("169.232." == a.."."..b..".") then
if not (strsub(strlower(user.sName),1,6) == "[ucla]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
user:Ban()
else
SendToAll(Bot, "The user "..user.sName.." from [UCLA] ha entered the Hub.")
end
elseif ("128.54." == a.."."..b..".") then
if not (strsub(strlower(user.sName),1,6) == "[ucsd]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
user:Ban()
else
SendToAll(Bot, "The user "..user.sName.." from [UCSD] ha entered the Hub.")
end
elseif ("169.229." == a.."."..b..".") then
if not (strsub(strlower(user.sName),1,6) == "[ucb]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
user:Ban()
else
SendToAll(Bot, "The user "..user.sName.." from [UCB] ha entered the Hub.")
end
elseif ("128.155." == a.."."..b..".") then
if not (strsub(strlower(user.sName),1,6) == "[usc]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
user:Ban()
else
SendToAll(Bot, "The user "..user.sName.." from [USC] ha entered the Hub.")
end
elseif ("169.233." == a.."."..b..".") then
if not (strsub(strlower(user.sName),1,6) == "[ucsc]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
user:Ban()
else
SendToAll(Bot, "The user "..user.sName.." from [UCSC] ha entered the Hub.")
end
elseif ("120." == a..".") then
if not (strsub(strlower(user.sName),1,6) == "[usd]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
user:Ban()
else
SendToAll(Bot, "The user "..user.sName.." from [USD] ha entered the Hub.")
end
end
end
Best regards, nErBoS
you are forgetting about harry potter, aka magic.
check here (http://board.univ-angers.fr/thread.php?threadid=763&boardid=4&styleid=1) for how 2 solve this.
plop
Hi,
Plop great manual on magical caracters, i am a little sleepy here, i found a bug on user.sName that have only 5 caracters corrected that, was this what you ment ??
Bot = "School-Check"
function Main()
frmHub:RegBot(Bot)
end
function NewUserConnected(user, data)
local s,e,a,b,c,d = strfind(user.sIP, "(%d+).(%d+).(%d+).(%d+)")
if ("169.232." == a.."."..b..".") then
if not (strsub(strlower(user.sName),1,6) == "[ucla]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
user:Ban()
else
SendToAll(Bot, "The user "..user.sName.." from [UCLA] ha entered the Hub.")
end
elseif ("128.54." == a.."."..b..".") then
if not (strsub(strlower(user.sName),1,6) == "[ucsd]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
user:Ban()
else
SendToAll(Bot, "The user "..user.sName.." from [UCSD] ha entered the Hub.")
end
elseif ("169.229." == a.."."..b..".") then
if not (strsub(strlower(user.sName),1,5) == "[ucb]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
user:Ban()
else
SendToAll(Bot, "The user "..user.sName.." from [UCB] ha entered the Hub.")
end
elseif ("128.155." == a.."."..b..".") then
if not (strsub(strlower(user.sName),1,5) == "[usc]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
user:Ban()
else
SendToAll(Bot, "The user "..user.sName.." from [USC] ha entered the Hub.")
end
elseif ("169.233." == a.."."..b..".") then
if not (strsub(strlower(user.sName),1,6) == "[ucsc]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
user:Ban()
else
SendToAll(Bot, "The user "..user.sName.." from [UCSC] ha entered the Hub.")
end
elseif ("120." == a..".") then
if not (strsub(strlower(user.sName),1,5) == "[usd]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
user:Ban()
else
SendToAll(Bot, "The user "..user.sName.." from [USD] ha entered the Hub.")
end
end
end
Please instructe me :)
Best regards, nErBoS
QuoteOriginally posted by nErBoS
Hi,
Plop great manual on magical caracters, i am a little sleepy here, i found a bug on user.sName that have only 5 caracters corrected that, was this what you ment ??
Please instructe me :)
Best regards, nErBoS
nope, it's about this part.
local s,e,a,b,c,d = strfind(user.sIP, "(%d+).(%d+).(%d+).(%d+)")
the . matches anything so you should escape it 2 be safe as it can return bad vallue's.
plop
Is the script Nerbos wrote completed? I used the initial script which seemed to be decent, what is wrong with it?
Hi,
Thanks plop you are right, problem solved, have to pay more atention to that.
frankyk this one is ok..
Bot = "School-Check"
function Main()
frmHub:RegBot(Bot)
end
function NewUserConnected(user, data)
local s,e,a,b,c,d = strfind(user.sIP, "(%d+)%.(%d+)%.(%d+)%.(%d+)")
if ("169.232." == a.."."..b..".") then
if not (strsub(strlower(user.sName),1,6) == "[ucla]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
user:Ban()
else
SendToAll(Bot, "The user "..user.sName.." from [UCLA] ha entered the Hub.")
end
elseif ("128.54." == a.."."..b..".") then
if not (strsub(strlower(user.sName),1,6) == "[ucsd]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
user:Ban()
else
SendToAll(Bot, "The user "..user.sName.." from [UCSD] ha entered the Hub.")
end
elseif ("169.229." == a.."."..b..".") then
if not (strsub(strlower(user.sName),1,5) == "[ucb]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
user:Ban()
else
SendToAll(Bot, "The user "..user.sName.." from [UCB] ha entered the Hub.")
end
elseif ("128.155." == a.."."..b..".") then
if not (strsub(strlower(user.sName),1,5) == "[usc]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
user:Ban()
else
SendToAll(Bot, "The user "..user.sName.." from [USC] ha entered the Hub.")
end
elseif ("169.233." == a.."."..b..".") then
if not (strsub(strlower(user.sName),1,6) == "[ucsc]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
user:Ban()
else
SendToAll(Bot, "The user "..user.sName.." from [UCSC] ha entered the Hub.")
end
elseif ("120." == a..".") then
if not (strsub(strlower(user.sName),1,5) == "[usd]") then
SendToAll(Bot, "The user "..user.sName.." is not from the right school, change your tag!")
user:Ban()
else
SendToAll(Bot, "The user "..user.sName.." from [USD] ha entered the Hub.")
end
end
end
Best regards, nErBoS
QuoteOriginally posted by frankyk
Is the script Nerbos wrote completed? I used the initial script which seemed to be decent, what is wrong with it?
was just a potential problem, didn't cause any error @ all but wasn't nice either.
nerbos is trying 2 learn lua thats why i only gave the hints so he had 2 fix it himself.
he used a . 2 search for the . in the ip's, but this can cause a problem because . means in lua that any character is ok.
in the last version he altered it 2 %. which means: search for a explicit .
make sure you run the last version he posted so you don't run into that potential problem.
QuoteOriginally posted by nErBoS
Hi,
Thanks plop you are right, problem solved, have to pay more atention to that.
Best regards, nErBoS
yw.
i made the same mistake in the past also, and it can be really confusing when it happens.
you should now be safe from mistakes like that.
plop