PtokaX forum

Archive => Archived 5.0 boards => Finished Scripts => Topic started by: -PT-B2S on 03 August, 2005, 14:13:07

Title: DC++ Kick interception
Post by: -PT-B2S on 03 August, 2005, 14:13:07
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