AntiSpam
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

AntiSpam

Started by Thor, 16 April, 2006, 20:12:51

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Thor

Converted to LUA 5.1
--|-----------------------------------------
--|
--| Antispammer and advertiser script
--|
--| The newly connected unregistered users 
--| 
--| can't write url-s nor the mainchat,
--|
--| nor the pivate chat for the setted time
--|
--| written by Hungarista 2006.04.14
--|
--| thanks the help of Bastya_elvtars
--|
--| and as always to Szmeby
--|
--| Converted LUA 5.1 2oo6.04.16
--|
--|-----------------------------------------

tBadWords={
[1] = "http",
[2] = "www",
[3] = "dchub",
--[4] = "anything", and so on...
}

function NewUserConnected(curUser)
newuser = curUser.sName
SetTimer(15000)
StartTimer()
end

kick = true

ChatArrival = function(curUser,data)
	if curUser.iProfile == -1 then
		if GetTimer() == 1 then
			if curUser.sName == newuser then 
				for i,v in pairs(tBadWords) do
				_,_,msg = string.find(data,"%b<>%s(.*)")
				msg = string.lower(msg)
				msg = string.gsub(msg,"[^a-z0-9]", "")
					if string.find(msg,v) then
					timer = GetTimerInterval()/1000
						if not kick then
						curUser:SendData(frmHub:GetHubBotName(),"Please... Don't advertise and don't spam ;) Thanks. You can't write links to the mainchat for "..timer.." second after connecting, please wait if it is important.")
						SendPmToOps(frmHub:GetOpChatName(),""..curUser.sName.." tried to spamming in the main: ["..(os.date("%H:%M:%S")).."] "..string.sub(data,1,-2).."")
						elseif kick then
						curUser:SendPM(frmHub:GetHubBotName(),"You are being kicked because: Don't advertise and don't spam!")
						curUser:Kick(frmHub:GetHubBotName(),"No-no-no, we don't like spammers and advertisers...")
						SendPmToOps(frmHub:GetOpChatName(),""..curUser.sName.." has been kicked because tried to spamming in the main: "..string.sub(data,1,-2).."")
						SendToAll(frmHub:GetHubBotName(),""..frmHub:GetHubBotName().." is kicking "..curUser.sName.." because: We really don't like spammers...")
						end
					return 1
					end
				end
			end
		end
	elseif curUser.bOperator then
		_,_,comd,arg = string.find(data,"%b<>%s(%S+)%s(%S+)|")
		if comd == "!skick" then
			if arg == "on" then
				if kick == true then
				curUser:SendData(frmHub:GetHubBotName(),"*** Spam kicking already Enabled")
				else
				kick = true
				curUser:SendData(frmHub:GetHubBotName(),"*** Spam kicking now Enabled")
				end
			elseif arg == "off" then 
				if kick == false then
				curUser:SendData(frmHub:GetHubBotName(),"*** Spam kicking already Disabled")
				else
				kick = false
				curUser:SendData(frmHub:GetHubBotName(),"*** Spam kicking now Disabled")
				end
			end
		return 1
		end
	end
end
ToArrival = function(curUser,data)
	if curUser.iProfile == -1 then
		if GetTimer() == 1 then
			if curUser.sName == newuser then
			_,_, tomsg = string.find(data, "^%$To:%s%S+%sFrom:%s%S+%s%$%b<>%s(.*)")
			_,_, nickto, nickfrom, msg = string.find(data, "^%$To:%s(%S+)%sFrom:%s(%S+)%s%$%b<>%s(.+)")
			msg = string.lower(msg)
			msg = string.gsub(msg,"[^a-z0-9]", "")
				for i,v in pairs(tBadWords) do
					if string.find(msg,v) then
					timer = GetTimerInterval()/1000
					curUser:SendPM(nickto,"I didn't get this message... You can't write links to the private chat for "..timer.." second after connecting, please wait if it is important.")
						if not kick then
						SendPmToOps(frmHub:GetOpChatName(),""..curUser.sName.." tried to spamming in private chat: "..tomsg.."")
						elseif kick then
						curUser:SendPM(frmHub:GetHubBotName(),"You are being kicked because: Don't advertise and don't spam!")
						curUser:Kick(frmHub:GetHubBotName(),"No-no-no, we don't like spammers and advertisers...")
						SendPmToOps(frmHub:GetOpChatName(),""..curUser.sName.." has been kicked because tried to spamming in private chat: "..tomsg.."")
						SendToAll(frmHub:GetOpChatName(),""..frmHub:GetHubBotName().." is kicking "..curUser.sName.." because: We really don't like spammers...")
						end
					return 1
					end
				end
			end
		end
	end
end

function OnTimer()
StopTimer()
end

--- Edited
In ToArrival missing pairs added thx Markitos :)

Markitos

for i,v in tBadWords do
in ToArrival function  ;D

mastdesi

can u plz make the time from 15 seconds to like forever?????? (i tried changing the time my self but it stay at 15 seconds )

and one more thing i want it to work for regged uesers also.


Thor


rik007

how i get this script  ???

SMF spam blocked by CleanTalk