PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: deus on 14 August, 2005, 21:26:34

Title: seeing recipient of an advert in opchat
Post by: deus on 14 August, 2005, 21:26:34
i got a anti advert scripts and i want to add one function to it, the addition is that i want to see who the recipient of the advertise is...

example: User "SomeUser" was banned for advertising to "OtherUser": somehub.somedomain.com

i got it all working except the "OtherUser"... is it even possible to see who gets the pm?

it would be really great if someone could help me out with this...

thanx in advance
Deus

*EDIT*
maybe I should have posted this in "help with scripts" but in that case maybe some nice moderator can move it there
*EDIT*
Title:
Post by: Jelf on 14 August, 2005, 21:57:27
here..-----------------------------------------------------------------
-- A.I. Anti Advertising v1.1 - written by Guibs 21th Apr 2003 --
-----------------------------------------------------------------
---------------------
-- Version History --
---------------------
-- Converted to Lua5 By Jelf 10/03/05
-- v1.1 Changes synthax about 'strfind' (Thks to sedulus for the tips), by Guibs 21th Apr 2003
-- v1.1 added +allowedadd, +refusedadd commands (Thks to Dazzler for the ideas), by Guibs 21th Apr 2003
-- v1.0 first version. Greets to sebastiannielsen for the cool idea

-- It works in PM, and on the main chat & blocks the bad addresses
-- Ops can't be kicked
-- Edit the safeadd list, to put your good hub addresses

------------------------------------
-- Sourcecode is below this point --
------------------------------------

safeadd = {
["landofps.ath.cx"]=1,
["landofps2.ath.cx"]=2
}

trigs = {
["dns2go"]=1,
["myftpsite"]=2,
["servebeer"]=3,
["mine.nu"]=4,
["ip.com"]=5,
["dynip"]=6,
["staticip"]=7,
["serveftp"]=8,
["ipactive"]=9,
["ip.org"]=10,
["servegame"]=11,
["ath.cx"]=12,
["dyndns"]=13,
["clanpimp"]=14,
["idlegames"]=15,
["sytes"]=16,
["uni.cc"]=17,
["homeunix"]=18,
["deftonzs.com"]=19,
["flamenap"]=20,
["xs4all"]=21,
["serveftp"]=22,
["myftp"]=23,
["http://www.angelfire.com"]=24,
["hopto.org"]=25,
["orgdns"]=26
}

---------------------
-- Global Settings --
---------------------
returndata = 0
founded = 0
safe = 0
allowedadd = 0
refusedadd = 0
opchat = frmHub:GetOpChatName()
Bot = frmHub:GetHubBotName()
---------------------------------
function ChatArrival(user, data)
if (string.sub(data,1,1)=="<") then
data=string.sub(data,1,string.len(data)-1)
s,e,to,cmd=string.find(data,"<(.*)>%s+(%S+)")
cmd=string.lower(cmd)
s,e,cmd = string.find(data,"%b<>%s+(%S+)")
if user.bOperator then
if (cmd=="+allowedadd") then
user:SendData(Bot, allowedadd.." allowed addresses have been sent on the main chat or in pm")
returndata = 1
return 1
elseif (cmd=="+refusedadd") then
user:SendData(Bot, refusedadd.." refused addresses have been sent on the main chat or in pm")
returndata = 1
return 1
end
end
if user.bOperator then
else
for key,a in trigs do
if(string.find(string.lower(data),key,5,1)) then
founded = 1
break
end
end
if founded == 1 then
for safekey,a in safeadd do
if(string.find(string.lower(data),safekey,5,1)) then
safe = 1
break
end
end
end
if founded == 1 then
if safe == 1 then
allowedadd=allowedadd+1
else
returndata = 1
refusedadd=refusedadd+1
SendPmToOps(opchat, user.sName.." has been disconnected because of advertising: "..data )
user:SendData(Bot, "You have been disconnected because of advertising")
user:Disconnect()
end
end
end
end
end
-----------------------------
function ToArrival(user, data)
if(string.sub(data, 1, 4) == "$To:") then
data=string.sub(data,1,string.len(data)-1)
s,e,whoTo = string.find(data,"$To:%s+(%S+)")
s,e,To,from,cmd = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.*)")
if user.bOperator then
else
for key,a in trigs do
if(string.find(string.lower(data),key,17,1)) then
founded = 1
break
end
end
if founded == 1 then
for safekey,a in safeadd do
if(string.find(string.lower(data),safekey,17,1)) then
safe = 1
break
end
end
end
if founded == 1 then
if safe == 1 then
allowedadd=allowedadd+1
else
returndata = 1
refusedadd=refusedadd+1
SendPmToOps(opchat, user.sName.." has been disconnected because of advertising: "..data )
user:SendData(Bot, "You have been disconnected because of advertising")
user:Disconnect()
end
end
end
end
return returndata
end
Just change the hub addy in safeadd for addresses which are ok to advertise, I left some in just to show you how they look.
Title:
Post by: deus on 14 August, 2005, 22:57:48
thanks for the fast reply... didnt need the entire script but i found the part i needed...

works perfectly