Author Topic: Convert Warn bot  (Read 1512 times)

0 Members and 1 Guest are viewing this topic.

Offline ?[-?Genius?-]?

  • Double Ace
  • *
  • Posts: 118
  • Karma: +3/-1
Convert Warn bot
« on: 10 August, 2009, 04:46:55 »
Hi

Its possible convert this script?

Code: [Select]
-- Kick/Warn v1.0 by jiten  
-- with:  
-- Immune Profiles/Allowed Profiles  
-- Kick/Warn Limit and Timeban  
  
tConf = { -- Script settings  
mSet = {  
sBot = frmHub:GetHubBotName(), -- bot name  
iTimeBan = 20, -- in minutes  
wLimit = 15, -- warn limit  
kLimit = 3, -- Kick limit  
},  
tKick = {},  
tWarn = {},  
}  
  
AllowedProfiles = {  
[-1] = 0, -- unreg  
[0] = 1, -- master  
[1] = 1, -- operator  
[2] = 1, -- vip  
[3] = 0, -- reg  
[4] = 0, -- moderator  
[5] = 0, -- founder  
}  
  
ImmuneProfiles = {  
[-1] = 0, -- unreg  
[0] = 1, -- master  
[1] = 1, -- operator  
[2] = 1, -- vip  
[3] = 0, -- reg  
[4] = 0, -- moderator  
[5] = 0, -- founder  
}  
  
function KickArrival(user, data)  
--## Client Kick ##--  
return 1  
end  
  
function ToArrival(user, data)  
local s,e,cmd = string.find(data, "%b<>%s[%!%+](%S+)")  
if cmd then  
ChatArrival(user, data)  
end  
  
if (string.find(data, "You are being kicked because:")) then  
return 1  
end  
end  
  
  
function ChatArrival (user,data)    
if (string.find(data, "is kicking")) then  
if (user.bOperator) then  
local _,_, name,reason = string.find(data,"%sis%skicking%s(%S+)%sbecause:%s*(.*)")  
if (GetItemByName(name) ~= nil) then  
local victim = GetItemByName(name)  
local operador = GetItemByName(user.sName)  
if tConf.tKick[victim.sName] == nil then  
tConf.tKick[victim.sName] = {}  
tConf.tKick[victim.sName]["Kicked"] = {}  
tConf.tKick[victim.sName]["Kicked"] = 1  
else  
tConf.tKick[victim.sName]["Kicked"] = tConf.tKick[victim.sName]["Kicked"] + 1  
end  
if (tConf.tKick[victim.sName]["Kicked"] == tConf.mSet.kLimit) then  
victim:SendData(tConf.mSet.sBot, "You are being banned because: "..reason)  
SendToOps(tConf.mSet.sBot, "O utilizador "..victim.sName.." foi banido por: "..user.sName.." porque: "..reason )  
victim:NickBan(reason, user.sName)  
victim:Disconnect()  
else  
victim:SendData(tConf.mSet.sBot, "You are being kicked because: "..reason)  
victim:SendData(tConf.mSet.sBot, "At the 3rd kick you will be automatically banned!!")  
SendToOps(tConf.mSet.sBot, "O utilizador "..victim.sName.." foi kickado por: "..user.sName.." porque: "..reason)  
SendToOps(""..user.sName.."", ""..user.sName.." is kicking "..victim.sName.." because:"..reason)  
victim:TempBan()  
victim:Disconnect()  
end  
else  
return 1  
end  
else  
end  
return 1  
end  
data=string.sub(data,1,-2)    
local s,e,cmd = string.find ( data, "%b<>%s+[%!%?%+%#](%S+)" )  
if cmd then  
local s,e,usr,reason = string.find( data, "%b<>%s+%S+%s+(%S+)%s*(.*)" )  
local tCmds = {    
["warn"] = function(user,data)  
if AllowedProfiles[user.iProfile] == 1 then  
if usr == nil or reason == nil then  
user:SendData(tConf.mSet.sBot, "*** Syntax Error: Type !warn <nickname> <reason>")  
else  
local victim = GetItemByName(usr)  
if (victim == nil) then  
user:SendData(tConf.mSet.sBot, "The user "..usr.." is not online.")  
else  
if ImmuneProfiles[victim.iProfile] ~= 1 then  
if tConf.tWarn[victim.sName] == nil then  
tConf.tWarn[victim.sName] = {}  
tConf.tWarn[victim.sName]["Warned"] = {}  
tConf.tWarn[victim.sName]["Warned"] = 1  
else  
tConf.tWarn[victim.sName]["Warned"] = tConf.tWarn[victim.sName]["Warned"] + 1  
end  
else  
user:SendData(tConf.mSet.sBot,"*** Error: You can't warn Immune Profile Users.")  
return 0  
end  
if (tConf.tWarn[victim.sName]["Warned"] == tConf.mSet.wLimit) then  
victim:SendPM(tConf.mSet.sBot, "You are being warned and disconnected because: "..reason)  
SendToOps(tConf.mSet.sBot, "O utilizador "..victim.sName.." foi kickado por "..user.sName.." porque: "..reason)  
tConf.tWarn[victim.sName] = nil  
victim:TempBan()  
victim:Disconnect()  
else  
victim:SendPM(tConf.mSet.sBot, "You are being warned because: "..reason)  
victim:SendPM(tConf.mSet.sBot, "At the 3rd warning you will be automatically kicked!!")  
SendPmToOps(tConf.mSet.sBot, "O user "..victim.sName.." foi avisado por "..user.sName.." porque: "..reason)  
end  
end  
end  
else  
user:SendData(tConf.mSet.sBot,"*** Error: You are not allowed to use this command.")  
end  
end,  
  
["kick"] = function(user,data)  
if AllowedProfiles[user.iProfile] == 1 then  
if usr == nil or reason == nil then  
user:SendData(tConf.mSet.sBot, "*** Syntax Error: Type !kick <nickname> <reason>")  
else  
local victim = GetItemByName(usr)  
if (victim == nil) then  
user:SendData(tConf.mSet.sBot, "The user "..usr.." is not online.")  
else  
if tConf.tKick[victim.sName] == nil then  
tConf.tKick[victim.sName] = {}  
tConf.tKick[victim.sName]["Kicked"] = {}  
tConf.tKick[victim.sName]["Kicked"] = 1  
else  
tConf.tKick[victim.sName]["Kicked"] = tConf.tKick[victim.sName]["Kicked"] + 1  
end  
if (tConf.tKick[victim.sName]["Kicked"] == tConf.mSet.kLimit) then  
victim:SendData(tConf.mSet.sBot, "You are being banned because: "..reason)  
SendToOps(tConf.mSet.sBot, "O utilizador "..victim.sName.." foi banido por: "..user.sName.." porque: "..reason)  
victim:NickBan(reason, user.sName)    
victim:Disconnect()  
else  
victim:SendData(tConf.mSet.sBot, "You are being kicked because: "..reason)  
victim:SendData(tConf.mSet.sBot, "At the 3rd kick you will be automatically banned!!")  
SendToOps(tConf.mSet.sBot, "O utilizador "..victim.sName.." foi kickado por : "..user.sName.." porque: "..reason)  
SendToOps(""..user.sName.."", ""..user.sName.." is kicking "..victim.sName.." because:"..reason)  
victim:TempBan()  
victim:Disconnect()  
end  
end  
end  
else  
user:SendData(tConf.mSet.sBot,"*** Error: You are not allowed to use this command.")  
end  
end,  
  
["disconnect"] = function(user,data)  
if user.iProfile == 0 or user.iProfile == 1 then  
if usr == nil then  
user:SendData(tConf.mSet.sBot, "*** Syntax Error: Type !disconnect <nickname>")  
else  
local victim = GetItemByName(usr)  
if (victim == nil) then  
user:SendData(tConf.mSet.sBot, "The user "..usr.." is not online.")  
else  
victim:Disconnect()  
SendToOps(tConf.mSet.sBot, "O utilizador "..usr.." foi desligado por "..user.sName)  
end  
end  
else  
user:SendData(tConf.mSet.sBot,"*** Error: You are not allowed to use this command.")  
end  
end,  
}  
if tCmds[cmd] then    
return tCmds[cmd](user,data), 1  
end  
end  
end  

PtokaX forum

Convert Warn bot
« on: 10 August, 2009, 04:46:55 »