Author Topic: detect only if msg is exactlly...  (Read 1384 times)

0 Members and 1 Guest are viewing this topic.

Offline blackwings

  • Scripter
  • King
  • ******
  • Posts: 986
  • Karma: +12/-8
detect only if msg is exactlly...
« on: 11 March, 2005, 05:52:48 »
Well, I'm experimeting a bit and trying to improve my anti advertise script. The problem I have is that the script only detect and take action of the message is exactlly the same as in the "CrushAdver = {}", which is bad, anyone know how to fix that???
Code: [Select]
--Advertise Crusher by blackwings
--v2.0
--functions:
-- anti-advertise - detect and tempban
-- safe advertise - so you can type the hubs own adress
-- Counter       - aka adverKill, in default it bans after 3 tempbans
-- Many Signs     - can detect advertisment that use different signs then "."
--      Tempban left   - how many tempbans a user has before permban
-----------
------------------------------------------------------------------------
--++++++++++++++++++++++ START OF CONFIGURATION ++++++++++++++++++++++--
------------------------------------------------------------------------
Bot = "#Anti-Advertise"

-- (1)Shall be tempbanned/banned / (0) this profile shouldn't be effected.

-- How many times a user gets tempbanned before getting a permban
adverKill = 3
-- If the "kill" messages should be shown to everyone in main chat
ShowAllinMain = 1

--Put the first part of you safe advertise adress here
theSafeAdver={
"safe1.no-ip.com","safe2.no-ip.com","safe3.no-ip.com","http://www.no-ip.com",
}

DNS01={
"no-ip","mine","sytes","dynip","dyndns","gotdns","kicks-ass","d2g","serveftp",
"servehttp","servehalflife","servequake","servecounterstrike","xs4all","myftp",
"servebeer","zapto","tropico","lysekil","udgnet","dnsalias","dynalias","ath","homeip",
"servemp3","hopto","servegame","staticip","orgdns","myftpsite","ipactive","idlegames",
"homeunix","homelinux","flamenap","dns2go","clanpimp","bounceme","ip","uni","is-a-geek","isa-geek"
}

MSigns={".","_","-","+","?","&","*","=","!","#","|","?","?","?","?","@","$","%","^"}
DNS02={"com","net","org","nu","se","cx","us","it","co.uk","info","biz","cc","de","tv","nl","dk","lv"}
------------------------------------------------------------------------
--+++++++++++++++++++++++ END OF CONFIGURATION +++++++++++++++++++++++--
------------------------------------------------------------------------

adverCounter = 0
CrushAdver = {}

function Main()
for key8, value8 in MSigns do
tSigns = strlower(value8)
for key4, value4 in DNS01 do
tPart01 = strlower(value4)
for key5, value5 in DNS02 do
tPart02 = strlower(value5)
--
advDetect = tSigns..tPart01..tSigns..tPart02
--
CrushAdver[advDetect]=1
end
end
end
end

function adverSmashing(user)
if not user.bOperator then
adverCounter = adverCounter + 1
tmpBanLeft = adverKill - adverCounter
if adverCounter < adverKill then
user:SendData(Bot, "You are tempbanned because of advertiseing.")
user:SendData(Bot, "Number of tempban before permban = "..tmpBanLeft)
user:TempBan()
SendToOps(Bot, "User <"..user.sName.."> was tempbanned for advertising, wrote = "..advDetect)
if ShowAllinMain == 1 then
SendToAll(Bot, "User <"..user.sName.."> was tempbanned for advertising")
end
elseif adverCounter == adverKill then
user:SendData(Bot, "You are PERMBANNED because of advertiseing")
user:Ban()
SendToOps(Bot, "User <"..user.sName.."> was PERMBANNED for advertising, wrote = "..advDetect)
if ShowAllinMain == 1 then
SendToAll(Bot, "User <"..user.sName.."> was PERMBANNED for advertising")
end
adverCounter = 0
end
end
collectgarbage()
end

function DataArrival(user,data)
local _, _, msg = strfind(data, "^%b<>%s+(.*)|")
if CrushAdver[msg]==1 then
return adverSmashing(user)
end
end


PtokaX forum

detect only if msg is exactlly...
« on: 11 March, 2005, 05:52:48 »