Forum

> > CS2D > Scripts > no ban admin
Forums overviewCS2D overview Scripts overviewLog in to reply

English no ban admin

1 reply
To the start Previous 1 Next To the start

old no ban admin

superpegamento
User Off Offline

Quote
I need a script so they can not ban managers with the command !ban

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
eg:

admins = {}

addhook ("say", "banuser")
banuser function (id, text)
for _, usgn in ipairs (admins) do
if player (id, 'usgn') == usgn then
if txt: lower (): sub (1,4) == "! ban" then
toban = txt: sub (6)
parse ("banname" .. toban .. "")
parse ("banip" .. toban .. "")
parse ("banusgn" .. toban .. "")
end
end
end
end

I do not want the command !ban be ejected from the same administrators


sorry my English

old Re: no ban admin

sheeL
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function string.split(split,pat)
     local t = {}
     for item in string.gmatch(split, pat) do
          table.insert(t,item)
     end
     return t
end

function checkban(cmd)
     local cmdt=string.split(cmd,"(%S*)")
     if cmdt[1]:sub(1,3)=="ban" then
          local param
          if cmdt[1]=="banip" then
               param="ip"
          elseif cmdt[1]=="banname" then
               param="name"
          elseif cmdt[1]=="banusgn" then
               param="usgn"
          end
          for _,a in pairs(admins) do
               if player(a,param)==cmdt[2] then
                    return true
               end
          end
     end
     return false
end

addhook("parse","cantbanadmins1")
addhook("rcon","cantbanadmins2")
function cantbanadmins1(cmd)
     if checkban(cmd) then
          return 2
     end
end
function cantbanadmins2(cmd)
     if checkban(cmd) then
          return 1
     end
end

by engi
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview