Author Topic: Simple command blocker per Profile  (Read 1287 times)

0 Members and 1 Guest are viewing this topic.

Offline the-master

  • Triple Ace
  • **
  • Posts: 217
  • Karma: +10/-15
Simple command blocker per Profile
« 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.
Code: [Select]
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 .
« Last Edit: 19 December, 2014, 14:19:00 by the-master »
keep on sharing :)
dchub://kickincountryhub.no-ip.org

PtokaX forum

Simple command blocker per Profile
« on: 19 December, 2014, 13:51:32 »

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Re: Simple command blocker per Profile
« Reply #1 on: 23 December, 2014, 19:04:09 »
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

Offline the-master

  • Triple Ace
  • **
  • Posts: 217
  • Karma: +10/-15
Re: Simple command blocker per Profile
« Reply #2 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  :'(
« Last Edit: 23 December, 2014, 19:30:17 by the-master »
keep on sharing :)
dchub://kickincountryhub.no-ip.org

PtokaX forum

Re: Simple command blocker per Profile
« Reply #2 on: 23 December, 2014, 19:28:34 »