Forum
CS2D Scripts How to make administrator commandsHow to make administrator commands
3 replies 1
There are already plenty of examples that utilizes the say hook for commands, why do you not go to do a search?
Oh, don't make me wrong, did you search with words like "how to make admin commands like !kick [plr_id]" or "admin commands like !kick [plr_id]"? If this is your case, learn how to search first.
I'm sure one of those 1080 results will give you what you need. Good luck.
Goodnight
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
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
Admin_Table = {160589}
RGBCLR = "255255255"
function table.find(tab,val)
for k, v in pairs(tab) do
if v == val then
return k
end
end
return false
end
function isAdmin(id)
return table.find(Admin_Table,player(id,"usgn"))
end
function string:split(b)
local cmd = {}
if type(self) == "string" then
if not b then match = "[^%s]+" else match = "[^"..b.."]+" end
for word in string.gmatch(self,match) do
table.insert(cmd,word)
end
end
return cmd
end
addhook("say","onSay")
function onSay(id,txt)
if txt == "rank" then
return 0
end
local s = txt:split()
if s[1] == "@say" then
txt = string.sub(txt,6)
if isAdmin(id) then
msg("©"..RGBCLR..player(id,"name").." (Admin): "..txt)
return 1
end
elseif s[1] == "!kick" then
local pl = tonumber(s[2])
if pl and player(pl,"exists") then
parse('kick '..pl)
end
return 1
end
end
Fixed!
1