Convert Warn bot
 

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

Convert Warn bot

Started by ?[-?Genius?-]?, 10 August, 2009, 04:46:55

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

?[-?Genius?-]?

Hi

Its possible convert this script?

-- 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  

SMF spam blocked by CleanTalk