Englisch Set Commands Permissions

6 Antworten
Gehe zu Seite
Zum Anfang Vorherige 1 Nächste Zum Anfang
02.07.18 10:34:44
Hoch
ImQuiet
User
Offline Off
Hi everyone,

Actually i came here for ask some help and i hope Somebody will help me.

Guys, i have some commands and i want to add these commands in hc admin script. actually i'm using different way for add commands in hc and really its soo easy i know how to add commands and commands works always.

But i just want add permissions, i mean Moderators/Admins cannot kill to each other, they can kill only v.i.p and users, i want if mods/admins mistakenly use punish command to other staff so msg show
" You Cannot Kill Staff members"


Spoiler >


Please help me for this, i'm really very happy if anybody will help and much appreciate
1× editiert, zuletzt 02.07.18 13:52:55
FRiendly boYy.
02.07.18 22:18:24
Hoch
you made 2 threads with same names about Commands there is already commmands in hc script
1× editiert, zuletzt 02.07.18 22:28:36
03.07.18 00:54:49
Hoch
Rainoth
Moderator
Offline Off
Make a variable that separates the ranks (for example, admin rank is 100, mod is 50, vip is 20 and so on)

When you see someone typing a command (in your case with !) check:
If user can use the command
If target's rank is lower than users
03.07.18 03:23:08
Hoch
use
Code:
1
if pl[id].lvl >= <ranklvl> then

Admin:15
Senior Moderator:10
Moderator:5
VIP:3
user. :1

if command for lvl 5 or any level the higher rank can use it

example:!kick for moderator also senior moderator and admin can use it

Spoiler >
4× editiert, zuletzt 03.07.18 20:48:15
03.07.18 21:25:10
Hoch
Rainoth
Moderator
Offline Off
@user KingShadow: You just added numeric ranks to commands. That's not what he's asking for. He wants commands to impact only people with lower ranks than the user of commands.
10.07.18 10:00:13
Hoch
ImQuiet
User
Offline Off
@user Rainoth: Can you make that for me? I'm noob in scripting.
FRiendly boYy.
10.07.18 23:42:34
Hoch
Rainoth
Moderator
Offline Off
I'm not going to write you everything, I can make you a good base for it, though.

Code:
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
commands = {
     player = {},
     hooks = {"say","join"},
     users = {
          [100] = {11111}, -- E.g. Admin
          [50] = {1234,12345}, -- Moderators
          [10] = {9999, 12333, 22, 8886} -- VIPs
     },
     cmd = {
     ["kick"] = {
          type = "player",
          level = 50,
          description = "Kicks a player",
          func = function(id)
               parse("kick "..id)
          end},
     ["slap"] = {
          type = "player",
          level = 10,
          description = "Slaps a player",
          func = function(id)
               parse("slap "..id)
          end},
     ["ban"] = {
          type = "player",
          level = 100,
          description = "IP bans a player",
          func = function(id)
               parse("banip "..player(id,"ip"))
          end}
     }
}
for k,v in pairs (commands.hooks) do
     addhook(v,"_"..v)
end

function _join(id)
     commands.player[id] = {}
     if player(id,"usgn") > 0 then
          for _,v in pairs (commands.users) do
               for rank,usgn in pairs (v) do
                    if player(id,"usgn") == v then
                         commands.player[id].ranking = rank
                    end
               end
          end
     end
end

function _say(id, txt)
     say = txt:split()
     if say[1]:sub(1,1) == "!" then
          for k,v in pairs(commands.cmd) do
               if k == say[1]:sub(2,#say[1]) then
                    if commands.player[id].ranking >= v.level then
                         if v.type == "player" and tonumber(say[2]) then
                              if commands.player[id].ranking > commands.player[tonumber(say[2])].ranking then
                                   v.func(tonumber(say[2])
                              else
                                   msg2(id,"Target outranks you.")
                              end
                         else
                              v.func(tonumber(say[2])
                         end
                    else
                         msg2(id,"Insufficient rank.")
                    end
               end
          end
          return 1
     end               
end

function string.split(str,pat) -- Splitting strings (sentences) into separate words
    local t = {}
    for word in string.gmatch(str,pat or "[^%s]+") do
        t[#t+1] = word
    end
    return t
end


Something like this. Mind I didn't test it and if I was making it for myself, I'd elaborate it way more.
Zum Anfang Vorherige 1 Nächste Zum Anfang