hi there.
can someone edit this script so that it doesn't censor everything that a nick containing those symbols types,
ex: everything that this nick types, is censored:
thanks in advance,
jiten
--====[ Advertising Shield ]====--
-- Version: 11
-- By: NightLitch
-- Date: 5/25/2004
----------------------------------------------------
-- Set Botname
BotName = "?bot?"
-- Set action for advertising ( 0=Warn / 1=Disconnect / 2=Kick / 3=Ban)
Action = 0
-- Set OK hubs that are allowed to be entered.
OkHubs = {
}
-- Accepted "sites" or triggers infront of the address
Sites = {
"www.",
"http://",
"ftp://",
"irc.",
"cs.",
}
-- Denyed/not allowed adver's sent in chat/pm
Adver = {
"?",
"?",
"?",
"?",
}
-- Extentions belonging to Adver above.
Ext = {
"",
}
-- Change characters.
CharCh = {
["%(dot%)"]=".",
["dot"]=".",
["%(%-%)"]="-",
["#"]="",
["!"]="",
["+"]="",
["%-"]="",
["*"]="",
["/"]="",
[" '"]="",
}
---------------------------------------------------------------
-- DON'T EDIT BELLOW --
tabAdvert = {}
function Main()
frmHub:RegBot(BotName)
end
function DataArrival(curUser, data)
local Msg = ""
if strsub(data, 1, 1) == "<" and not strfind(data,"> !") and not curUser.bOperator then
local _, _,line = strfind(data, "^%b<>%s+(.*)")
Msg = line
for i,v in CharCh do
line=gsub(line, i, v)
end
if CheckAdver(curUser,line,"in Main-Chat, typing",Msg)==1 then
return 1
end
elseif ( strsub(data, 1, 4) == "$To:" ) and not curUser.bOperator then
local _,_,to,from,line = strfind(data, "%$To:%s(%S+)%sFrom:%s(%S+)%s$(.*)$")
Msg = line
for i,v in CharCh do
line=gsub(line, i, v)
end
if CheckAdver(curUser,line,"in PM to "..to..", typing",Msg)==1 then
return 1
end
end
end
function CheckAdver(curUser,line,msg,Msg)
local adver,extension = Verify(curUser.sName, line,Adver), Verify(curUser.sName, line,Ext)
if adver and extension and OkAdver(line)~=1 then
tabAdvert = nil
tabAdvert = {}
local action = DoDisc(curUser,msg,line)
SendPmToOps(BotName,"SymbolKiller: <"..curUser.sName.."> ( "..curUser.sIP.." ) is "..action.." for advertising "..msg..": "..Msg)
return 1
end
end
function DoDisc(curUser,msg,line)
if Action==0 then
curUser:SendPM(BotName,"You are Warned for advertising "..msg..": "..line) return "Warned"
elseif Action==1 then
curUser:SendPM(BotName,"You are being Disconnected for advertising "..msg..": "..line)
curUser:Disconnect() return "Disconnected"
elseif Action==2 then
curUser:SendPM(BotName,"You are Kicked for advertising "..msg..": "..line)
curUser:TempBan() return "Kicked"
elseif Action==3 then
curUser:SendPM(BotName,"You are Banned for advertising "..msg..": "..line)
curUser:Ban() return "Banned"
end
end
function OkAdver(adver)
for i,v in OkHubs do
if strfind(adver,v) then
return 1
end
end
end
function Verify(userdata, msg,table)
if not msg then return end
tmp =""
gsub(strlower(msg), "([a-?0-9.:%-])", function(x) tmp = tmp..x end)
if not tabAdvert[userdata] then
tabAdvert[userdata] = { iClock = clock(), l1 = "", l2 = "", l3 = "", l4= "", l5= "",l6= "",l7= "",l8= "",l9 = tmp}
else
tabAdvert[userdata].iClock = clock()
tabAdvert[userdata].l1 = tabAdvert[userdata].l2
tabAdvert[userdata].l2 = tabAdvert[userdata].l3
tabAdvert[userdata].l3 = tabAdvert[userdata].l4
tabAdvert[userdata].l4 = tabAdvert[userdata].l5
tabAdvert[userdata].l5 = tabAdvert[userdata].l6
tabAdvert[userdata].l6 = tabAdvert[userdata].l7
tabAdvert[userdata].l7 = tabAdvert[userdata].l8
tabAdvert[userdata].l8 = tabAdvert[userdata].l9
tabAdvert[userdata].l9 = tmp
end
local Lines = tabAdvert[userdata].l1.."#"..tabAdvert[userdata].l2.."#"..tabAdvert[userdata].l3.."#"..tabAdvert[userdata].l4.."#"..tabAdvert[userdata].l5.."#"..tabAdvert[userdata].l6.."#"..tabAdvert[userdata].l7.."#"..tabAdvert[userdata].l8.."#"..tabAdvert[userdata].l9
for key, value in table do
if (strfind(Lines, strlower(value), 1, 1)) then
return 1
end
end
end
Hi,
Why don't you block at the connection ??? Try out this one...
--## BLCOK ILLEGAL CHAR
--## Requested by jiten
--## Made by nErBoS
sBot = "BIC-BOT"
arrIllegalChar = {
"?",
}
function Main(user)
frmHub:RegBot(sBot)
end
function NewUserConnected(user)
for i=1, getn(arrIllegalChar) do
if (strfind(user.sName, arrIllegalChar[i])) then
user:SendData(sBot, "Your nick has a illegal char: "..arrIllegalChar[i])
user:SendData(sBot, "Please remove it.")
user:Disconnect()
break
end
end
end
Best regards, nErBoS
I could block them at the connection, but, the problem is that there are many users that already have those symbols on their nicks, and we would lose a lot of them... because each time they get disconnected, it's for 20 minutes.
That's why i would like to check the messages, and not the nicks.
Hi,
Ok then, try out this one...
--## BLCOK ILLEGAL CHAR NICK TALK
--## Requested by jiten
--## Made by nErBoS
sBot = "BICNT-BOT"
arrIllegalChar = {
"?",
}
function Main(user)
frmHub:RegBot(sBot)
end
function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5) == "$To: ") then
local s,e,nick = strfind(data, "<(%S+)>")
if (GetItemByName(nick) ~= nil and ValidateNick(GetItemByName(nick)) == 1) then
return 1
end
end
end
function ValidateNick(user)
for i=1, getn(arrIllegalChar) do
if (strfind(user.sName, arrIllegalChar[i])) then
user:SendData(sBot, "Your nick has a illegal char: "..arrIllegalChar[i])
user:SendData(sBot, "If you want to talk in the HUB you must remove it.")
return 1
end
end
return 0
end
Best regards, nErBoS