Simple command blocker per Profile
 

Simple command blocker per Profile

Started by the-master, 19 December, 2014, 13:51:32

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

the-master

To block users for using req/rel part of DixbiT I created a small script but it can be used for any command.
ProfNotAllow={  -- profilelist
	[-1]=1, -- unregistered users
	[3]=1,  -- Regs
}

Block={ -- commands to block
"reladd","reqadd","reqfill","reldel","reqdel","rqsectiondel","rqstatus","rqsectionadd"
}


function ChatArrival(user,data)
	Core.GetUserAllData(user)
	local _,_,msg = data:find( "%b<> (.+)")
	local _,_,cmd = data:find( "^%b<> (%p%a+)")
	local _,_,arg = data:find( "^%b<> %p%a+ (%S+)|")
	if (ProfNotAllow[user.iProfile]==1) then
		if Check(cmd) then
		Core.SendToUser(user,"***Command  "..cmd.." Is Not allowed for your Profile")
			return true
		end
	end
end

function Check(cmd)
	for i = 1,#Block do
		if string.find( cmd, Block[i] , 1 , true ) then
			return 1
		end
	end
end


P.S. This script should run in PtokaX ABOVE all scripts or at least above the script it needs to block commands .
keep on sharing :)

PPK

Why is script needed for that when it is possible to set in dixbot ?  :shocking:
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

the-master

#2
Because we didn't have the DxMngr at that time, but it can be used for any command to block..
Not all hubowners are scripters to  :'(
keep on sharing :)

SMF spam blocked by CleanTalk