DC++ Kick interception
 

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

DC++ Kick interception

Started by -PT-B2S, 03 August, 2005, 14:13:07

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

-PT-B2S

Hello

This script intercept the DC++ (dcdm, strongdc++ and other OP clients) Kick command, and also do a "!kick" command that have a limit of kicks. After this limit, the script will Timeban the user. The profiles must be ih this order:

REG = 0
VIP = 1
OP = 2
MASTER = 3

You can add more commands, but it has to be in this order. For example, my profiles are like this:

REG = 0
ELITE = 1
VIP = 2
OP = 3
MODERATOR = 4
FOUNDER = 5

--##DC++ Kick interception by Hahn?(-PT-B2S)
-- 02-08-2005
-- Thanx to madman, TTB and zero-cool for the help 

sBot = "name of the bot"

tConf = { 
	mSet = {
		iTimeBan = 30, -- in minutes
		kLimit = 3, -- kick limit
	},
	tKick = {},
}

function ChatArrival(oUser,data)
	if string.find(data,"is kicking") then
		return 1
	end
end

function KickArrival(oUser, data)
	if string.find(data,"$Kick") then
		return 1
	end
end

function ToArrival(oUser,data)
	local _,_,whoTo,mes = string.find(data,"$To:%s+(%S+)%s+From:%s+%S+%s+$(.*)")
	if (string.find(mes,"%b<>%s+(.*)")) then
		victim = whoTo
		data = string.sub(mes,1,string.len(mes)-1)
		if string.find(data,"You are being kicked because") then
			reason = string.gsub(data,"(%S+)%s+You are being kicked because: ","")
			iVictim = GetItemByName(whoTo)
			SendToOps(sBot, " The User " ..oUser.sName.. " used this commad:  -- kick --  on the user  -- "..victim.." --  in "..os.date("%d").."-"..os.date("%m").."-"..os.date("%y").."  at  "..os.date("%H").."hours and "..os.date("%M").."min!")
			if oUser.bOperator then
				if (victim == nil) then
					oUser:SendData(sBot, "***Error, The user "..victim.." is not online")
				else
					if (oUser.bOperator) and (iVictim.iProfile < oUser.iProfile) then 
						if tConf.tKick[victim] == nil then
							tConf.tKick[victim] = {}
							tConf.tKick[victim]["Kicked"] = {}
							tConf.tKick[victim]["Kicked"] = 1
						else
							tConf.tKick[victim]["Kicked"] = tConf.tKick[victim]["Kicked"] + 1
						end
						if (tConf.tKick[victim]["Kicked"] == tConf.mSet.kLimit) then
							iVictim:SendPM(sBot, "You are beeing banned cause you have reached the kick limit with the reason: "..reason)
							SendToOps(sBot, "The User "..victim.." was banned by "..oUser.sName.." ,after reach the kick limit with the reason: "..reason)
							tConf.tKick[victim] = nil
							iVictim:TimeBan(tConf.mSet.iTimeBan)
						else
							iVictim:SendPM(sBot, "You are being kicked by "..oUser.sName.." because: "..reason)
							SendToOps(sBot, "O User "..victim.." was kicked by "..oUser.sName.." because: "..reason)
							iVictim:TempBan()
							iVictim:Disconnect()
						end
					end
					if (oUser.bOperator) and (iVictim.iProfile > oUser.iProfile) then 
						oUser:SendData(sBot, "You can not kick "..victim.." because he has a superior profile than yours!") 
					end
				end
			else
				oUser:SendData(sBot, "*** Error, You can not use this command.")
			end
		return 1
		end
	end
end


Props

SMF spam blocked by CleanTalk