Clean Mainchat For the new API
 

Clean Mainchat For the new API

Started by HillyBilly, 29 September, 2007, 01:14:23

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

HillyBilly

--[[
	For new API 
	
	HillyBilly	26 sept 07
	
	Took some bits and parts from
	 CrazyGuy and Mutor Lua 5.1.x and credits to them. 
	
	28 sept 07	
	added Cleaners table who may or may not clean.	-	speedX
	
--]]

cmdClean = "cleanmain"
soapwater = 100 -- For more or less soap and water

tCleaners = {
		[-1] = 0,	-- Unreg Users
		[0] = 1,	-- Masters
		[1] = 1,	-- Operators
		[2] = 0,	-- VIPs
		[3] = 0,	-- Regs
}
		
ChatArrival = function(User,Data)
	if tCleaners[User.iProfile] == 1 then
		local _,_,cmd = string.find(Data, "%b<>%s%p(%S+)|")
		if cmd and (cmd == cmdClean) then
			local str = "\n\n"..string.rep("\t",3).." "..
				User.sNick.." is clearing Main Chat...  ???"..
				string.rep("\n",soapwater)..string.rep("\t",3).."Main Chat Has "..
				"Been Cleared By: "..User.sNick.."   ???\n\n"
				Core.SendToAll(str)
				return true
			else
				return "Clear Main Chat","",""
			end
		end
	end


Cheers HB

influxor

#1
QuoteHi hillybilly,
Could u plzz add a profile table so as to give permission or not.

i get error:

Quote[07:04] Syntax ...\PtokaX 0.3.6.0\scripts\acleanchat.lua:32: attempt to concatenate field 'sNick' (a nil value)

Rincewind

That error sounds like you are using the pre-3.6.0d PtokaX which uses the old Lua API.

If you are then you need to either upgrade your PX to use this script as is, or change User.sNick to User.sName.

SMF spam blocked by CleanTalk