PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Finished Scripts => Topic started by: the-master on 19 December, 2014, 13:51:32

Title: Simple command blocker per Profile
Post by: the-master on 19 December, 2014, 13:51:32
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 .
Title: Re: Simple command blocker per Profile
Post by: PPK on 23 December, 2014, 19:04:09
Why is script needed for that when it is possible to set in dixbot ?  :shocking:
Title: Re: Simple command blocker per Profile
Post by: the-master on 23 December, 2014, 19:28:34
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  :'(