PtokaX forum

Archive => Archived 5.0 boards => Help with scripts => Topic started by: Zigurds on 01 November, 2005, 17:07:03

Title: Block URL links
Post by: Zigurds on 01 November, 2005, 17:07:03
Need scripts for block URL links in maichat


Sorry my bad English :(
------------------------------------
Owner for Latvian hub Alfa
Title:
Post by: 6Marilyn6Manson6 on 01 November, 2005, 17:58:01
Try this:

-- Block URL links 0.1
-- Made by 6Marilyn6Manson6 by 01/11/2005
--
-- Set action for advertising ( 0=Warn / 1=Disconnect / 2=Kick / 3=Ban / 4=TimeBan)
BotName = "NoLinks"
Action = 1
TimeBan = 20 -- Time Ban period

SITES = { "www.","http://","ftp://","irc.","cs." }

function Main()
frmHub:RegBot(BotName)
end

function SiteCheck(user,msg)
for value,index in SITES do
if string.find(msg,index) then
if Action==0 then
user:SendPM(BotName,"You are Warned for advertising: "..msg) return "Warned"
elseif Action==1 then
user:SendPM(BotName,"You are Disconnected for advertising: "..msg) user:Disconnect() return "Disconnected"
elseif Action==2 then
user:SendPM(BotName,"You are Kicked for advertising: "..msg) user:TempBan() return "Kicked"
elseif Action==3 then
user:SendPM(BotName,"You are Banned for advertising: "..msg) user:Ban() return "Banned"
elseif Action==4 then
user:SendPM(BotName,"You are TimeBanned for advertising: "..msg) user:TimeBan(TimeBan) return "TimeBanned"
end
end
end
end

C ya
Title:
Post by: Cêñoßy†ê on 01 November, 2005, 18:12:19
Small fix  :]

-- Block URL links 0.1
-- Made by 6Marilyn6Manson6 by 01/11/2005
--
-- Set action for advertising ( 0=Warn / 1=Disconnect / 2=Kick / 3=Ban / 4=TimeBan)
BotName = "NoLinks"
Action = 1
TimeBan = 20 -- Time Ban period

SITES = { "www.","http://","ftp://","irc.","cs." }

function Main()
frmHub:RegBot(BotName)
end

function SiteCheck(user,msg)
for value,index in SITES do
if string.find(msg,index) then
if Action==0 then
user:SendPM(BotName,"You are Warned for advertising: "..msg) return "Warned"
elseif Action==1 then
user:SendPM(BotName,"You are Disconnected for advertising: "..msg) user:Disconnect() return "Disconnected"
elseif Action==2 then
user:SendPM(BotName,"You are Kicked for advertising: "..msg) user:TempBan() return "Kicked"
elseif Action==3 then
user:SendPM(BotName,"You are Banned for advertising: "..msg) user:Ban() return "Banned"
elseif Action==4 then
user:SendPM(BotName,"You are TimeBanned for advertising: "..msg) user:TimeBan(TimeBan) return "TimeBanned"
[COLOR=red]end[/COLOR]
end
end
end
Title:
Post by: 6Marilyn6Manson6 on 01 November, 2005, 18:30:05
Oh yeah sorry for my error.. i ave made it in 2 minutes :p.. Post update. Thanks Cb :D
Title:
Post by: Zigurds on 01 November, 2005, 19:00:07
thanks :)))
Title:
Post by: 6Marilyn6Manson6 on 01 November, 2005, 19:03:34
QuoteOriginally posted by Zigurds
thanks :)))

Welcome dude :D
Title:
Post by: Zigurds on 01 November, 2005, 19:10:33
Sorry, one moment

Need only not visible URL links in maichat,
unwanted warns, bans or kicks

for admin rule extraneous


Sorry my bad English :(
------------------------------------
Owner for Latvian hub Alfa
Title:
Post by: Zigurds on 01 November, 2005, 19:13:13
note. Only mainchat, no private
Title:
Post by: Cêñoßy†ê on 01 November, 2005, 19:50:02
Try this one

-- Block URL links 0.1
-- Made by 6Marilyn6Manson6 by 01/11/2005
-- Mixed with parts of Simple AntiAdvertising Bot by NightLitch 2005-07-10 by C??o?y??
-- requested by Zigurds
-- Checks only mainchat
-- Set action for advertising ( 0=Warn / 1=Disconnect / 2=Kick / 3=Ban / 4=TimeBan)
-- Set who can type URL's ( 0=Yes 1=No)

BotName = "NoLinks"
Action = 0
TimeBan = 20 -- Time Ban period

CheckWho = {
[0] = 0, --Master
[1] = 0, --Operator
[2] = 1, --Vip
[3] = 1, --Reg
[-1] = 1, --Unregistered
}

function Main()
frmHub:RegBot(BotName)
end

adverTable = { "www.","http://","ftp://","irc.","cs."}

function ChatArrival(user,data)
if CheckWho == 1 then
local s,e,msg = string.find(data, "%b<>%s*(.*)%|$")
if checkForAdvertising(msg) then
if Action == 0 then
user:SendPM(BotName,"You are Warned for advertising: "..msg)
SendToOps(BotName, "*** User "..user.sName.." has been warned for advertising: "..msg)
return "Warned"
end
if Action == 1 then
user:SendData(BotName, "*** You have been Disconnected for advertising !!")
SendToOps(BotName, "*** User "..user.sName.." has been Disconnected for advertising: "..msg)
user:TempBan() return "Disconnected"
end
if Action == 2 then
user:SendData(BotName, "*** You have been kicked for advertising !!")
SendToOps(BotName, "*** User "..user.sName.." has been kicked for advertising: "..msg)
user:TempBan() return "Kicked"
end
if Action == 3 then
user:SendData(BotName, "*** You have been banned for advertising !!")
SendToOps(BotName, "*** User "..user.sName.." has been banned for advertising: "..msg)
user:Ban() return "Banned"
end
if Action == 4 then
user:SendData(BotName, "*** You have been timebanned for advertising !!")
SendToOps(BotName, "*** User "..user.sName.." has been timebanned for advertising: "..msg)
user:TimeBan(TimeBan) return "TimeBanned"
end
end
end
end

function checkForAdvertising(msg)
for i = 1,table.getn(adverTable) do
if string.find( msg , adverTable[i] , 1 , true ) then
return 1
end
end
return
end
Title:
Post by: 6Marilyn6Manson6 on 01 November, 2005, 19:59:52
GooD Cy?e??o?.. NightLitch is superstar :D
Title:
Post by: 6Marilyn6Manson6 on 01 November, 2005, 20:12:40
Small update in CheckWho:

-- Block URL links 0.1
-- requested by Zigurds
-- Made by 6Marilyn6Manson6 by 01/11/2005
--
-- Set action for advertising ( 0=Warn / 1=Disconnect / 2=Kick / 3=Ban / 4=TimeBan)
-- Set who can type URL's ( 0=Yes 1=No)
-- Checks only mainchat

BotName = "NoLinks"
Action = 0
TimeBan = 20 -- Time Ban period

CheckWho = {
[0] = 0, --Master
[1] = 0, --Operator
[2] = 1, --Vip
[3] = 1, --Reg
[4] = 0, --Moderator
[5] = 0, --NetFounder
[-1] = 1, --Unregistered
}

function Main()
frmHub:RegBot(BotName)
end

adverTable = { "www.","http://","ftp://","irc.","cs."}

function ChatArrival(user,data)
if CheckWho == 1 then
local s,e,msg = string.find(data, "%b<>%s*(.*)%|$")
if checkForAdvertising(msg) then
if Action == 0 then
user:SendPM(BotName,"You are Warned for advertising: "..msg)
SendToOps(BotName, "*** User "..user.sName.." has been warned for advertising: "..msg)
return "Warned"
end
if Action == 1 then
user:SendData(BotName, "*** You have been Disconnected for advertising !!")
SendToOps(BotName, "*** User "..user.sName.." has been Disconnected for advertising: "..msg)
user:TempBan() return "Disconnected"
end
if Action == 2 then
user:SendData(BotName, "*** You have been kicked for advertising !!")
SendToOps(BotName, "*** User "..user.sName.." has been kicked for advertising: "..msg)
user:TempBan() return "Kicked"
end
if Action == 3 then
user:SendData(BotName, "*** You have been banned for advertising !!")
SendToOps(BotName, "*** User "..user.sName.." has been banned for advertising: "..msg)
user:Ban() return "Banned"
end
if Action == 4 then
user:SendData(BotName, "*** You have been timebanned for advertising !!")
SendToOps(BotName, "*** User "..user.sName.." has been timebanned for advertising: "..msg)
user:TimeBan(TimeBan) return "TimeBanned"
end
end
end
end

function checkForAdvertising(msg)
for i = 1,table.getn(adverTable) do
if string.find( msg , adverTable[i] , 1 , true ) then
return 1
end
end
return
end

C ya
Title:
Post by: Zigurds on 01 November, 2005, 20:37:29
He he, mutual grace :)
Title:
Post by: 6Marilyn6Manson6 on 01 November, 2005, 20:42:12
QuoteOriginally posted by Zigurds
He he, mutual grace :)

No prob you're welcome here :D