Command !kick
3 replies



03.02.19 06:00:39 am
Hello
Command !kick <id> <reason>
i want, if i use this command on myself, then show Msg
" You can not kick yourself"
and if i type !kick <id> and <reason> missing then show msg
"reason must be entered"
i hope anybody will make it for me.
Command !kick <id> <reason>
i want, if i use this command on myself, then show Msg
" You can not kick yourself"
and if i type !kick <id> and <reason> missing then show msg
"reason must be entered"
i hope anybody will make it for me.
Which then of the favors of your lord will you deny?
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
81
82
83
84
85
86
87
88
89
90
91
92
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
81
82
83
84
85
86
87
88
89
90
91
92
Roles = {
[1] = 'Admin',
}
Permissions = {
['kick'] = 1
}
addhook('say', 'SayHook')
function SayHook(id, text)
return SayHookCommands(id, text) or 0
end
function SayHookCommands(id, text)
text = text:lower()
if string.sub(text, #text-1,#text) == '@C' then
text = string.sub(text, 1, #text-2)
end
if text:sub(1,1) == '!' then
print(GetGN(id)..' used the command: '..text)
command = text:sub(2):split(' ')
local arg = ToTable(text)
arg[1] = arg[1]:sub(2)
if arg[1] == 'kick' then
if --[[PLACE LEVEL OF PLAYER'S STAFF LEVEL HERE]] >= Permissions[arg[1]] then
if ValidArgument(arg[2]) and PlayerExists(tonumber(arg[2])) then
arg[3] = FixArgument(text, 3)
if not ValidArgument(arg[3]) then
arg[3] = 'No reason stated.'
end
parse('kick "'..tonumber(arg[2])..'" "'..arg[3]..'"')
else
ReturnError(id, 4)
end
else
ReturnError(id, 2, Permissions[arg[1]])
end
else
ReturnError(id, 1)
return 1
end
end
return 0
end
function ReturnError(id, error, level)
local text = ""
if error == 1 then
text = "Unknown command."
elseif error == 2 then
text = "A staff level of '"..Roles[level].."' is required to use this command."
elseif error == 3 then
text = "Invalid command arguments."
elseif error == 4 then
text = "The given argument either does not exist or it is invalid."
elseif error == 5 then
text = "You may not use this command on yourself."
elseif error == 6 then
text = "You may not use this command in this area."
elseif error == 7 then
text = "The player stated is already dead."
else
text = "Unknown exception has occured."
end
HUDMsg(id, text, "error")
end
function FixArgument(text, num)
local arg = ""
for k, v in ipairs(text:split(' ')) do
if k >= num then
arg = arg..' '..v
end
end
return arg
end
function ValidArgument(arg)
if arg and arg ~= "" then
return true
end
return false
end
function ToTable(t, match)
local cmd = {}
if not match then match = "[^%s]+" end
for word in string.gmatch(t, match) do
table.insert(cmd, word)
end
return cmd
end
[1] = 'Admin',
}
Permissions = {
['kick'] = 1
}
addhook('say', 'SayHook')
function SayHook(id, text)
return SayHookCommands(id, text) or 0
end
function SayHookCommands(id, text)
text = text:lower()
if string.sub(text, #text-1,#text) == '@C' then
text = string.sub(text, 1, #text-2)
end
if text:sub(1,1) == '!' then
print(GetGN(id)..' used the command: '..text)
command = text:sub(2):split(' ')
local arg = ToTable(text)
arg[1] = arg[1]:sub(2)
if arg[1] == 'kick' then
if --[[PLACE LEVEL OF PLAYER'S STAFF LEVEL HERE]] >= Permissions[arg[1]] then
if ValidArgument(arg[2]) and PlayerExists(tonumber(arg[2])) then
arg[3] = FixArgument(text, 3)
if not ValidArgument(arg[3]) then
arg[3] = 'No reason stated.'
end
parse('kick "'..tonumber(arg[2])..'" "'..arg[3]..'"')
else
ReturnError(id, 4)
end
else
ReturnError(id, 2, Permissions[arg[1]])
end
else
ReturnError(id, 1)
return 1
end
end
return 0
end
function ReturnError(id, error, level)
local text = ""
if error == 1 then
text = "Unknown command."
elseif error == 2 then
text = "A staff level of '"..Roles[level].."' is required to use this command."
elseif error == 3 then
text = "Invalid command arguments."
elseif error == 4 then
text = "The given argument either does not exist or it is invalid."
elseif error == 5 then
text = "You may not use this command on yourself."
elseif error == 6 then
text = "You may not use this command in this area."
elseif error == 7 then
text = "The player stated is already dead."
else
text = "Unknown exception has occured."
end
HUDMsg(id, text, "error")
end
function FixArgument(text, num)
local arg = ""
for k, v in ipairs(text:split(' ')) do
if k >= num then
arg = arg..' '..v
end
end
return arg
end
function ValidArgument(arg)
if arg and arg ~= "" then
return true
end
return false
end
function ToTable(t, match)
local cmd = {}
if not match then match = "[^%s]+" end
for word in string.gmatch(t, match) do
table.insert(cmd, word)
end
return cmd
end
Try this.
It's hard being the best girl in the whole entire world
Goo said has written:
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
81
82
83
84
85
86
87
88
89
90
91
92
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
81
82
83
84
85
86
87
88
89
90
91
92
Roles = {
[1] = 'Admin',
}
Permissions = {
['kick'] = 1
}
addhook('say', 'SayHook')
function SayHook(id, text)
return SayHookCommands(id, text) or 0
end
function SayHookCommands(id, text)
text = text:lower()
if string.sub(text, #text-1,#text) == '@C' then
text = string.sub(text, 1, #text-2)
end
if text:sub(1,1) == '!' then
print(GetGN(id)..' used the command: '..text)
command = text:sub(2):split(' ')
local arg = ToTable(text)
arg[1] = arg[1]:sub(2)
if arg[1] == 'kick' then
if --[[PLACE LEVEL OF PLAYER'S STAFF LEVEL HERE]] >= Permissions[arg[1]] then
if ValidArgument(arg[2]) and PlayerExists(tonumber(arg[2])) then
arg[3] = FixArgument(text, 3)
if not ValidArgument(arg[3]) then
arg[3] = 'No reason stated.'
end
parse('kick "'..tonumber(arg[2])..'" "'..arg[3]..'"')
else
ReturnError(id, 4)
end
else
ReturnError(id, 2, Permissions[arg[1]])
end
else
ReturnError(id, 1)
return 1
end
end
return 0
end
function ReturnError(id, error, level)
local text = ""
if error == 1 then
text = "Unknown command."
elseif error == 2 then
text = "A staff level of '"..Roles[level].."' is required to use this command."
elseif error == 3 then
text = "Invalid command arguments."
elseif error == 4 then
text = "The given argument either does not exist or it is invalid."
elseif error == 5 then
text = "You may not use this command on yourself."
elseif error == 6 then
text = "You may not use this command in this area."
elseif error == 7 then
text = "The player stated is already dead."
else
text = "Unknown exception has occured."
end
HUDMsg(id, text, "error")
end
function FixArgument(text, num)
local arg = ""
for k, v in ipairs(text:split(' ')) do
if k >= num then
arg = arg..' '..v
end
end
return arg
end
function ValidArgument(arg)
if arg and arg ~= "" then
return true
end
return false
end
function ToTable(t, match)
local cmd = {}
if not match then match = "[^%s]+" end
for word in string.gmatch(t, match) do
table.insert(cmd, word)
end
return cmd
end
[1] = 'Admin',
}
Permissions = {
['kick'] = 1
}
addhook('say', 'SayHook')
function SayHook(id, text)
return SayHookCommands(id, text) or 0
end
function SayHookCommands(id, text)
text = text:lower()
if string.sub(text, #text-1,#text) == '@C' then
text = string.sub(text, 1, #text-2)
end
if text:sub(1,1) == '!' then
print(GetGN(id)..' used the command: '..text)
command = text:sub(2):split(' ')
local arg = ToTable(text)
arg[1] = arg[1]:sub(2)
if arg[1] == 'kick' then
if --[[PLACE LEVEL OF PLAYER'S STAFF LEVEL HERE]] >= Permissions[arg[1]] then
if ValidArgument(arg[2]) and PlayerExists(tonumber(arg[2])) then
arg[3] = FixArgument(text, 3)
if not ValidArgument(arg[3]) then
arg[3] = 'No reason stated.'
end
parse('kick "'..tonumber(arg[2])..'" "'..arg[3]..'"')
else
ReturnError(id, 4)
end
else
ReturnError(id, 2, Permissions[arg[1]])
end
else
ReturnError(id, 1)
return 1
end
end
return 0
end
function ReturnError(id, error, level)
local text = ""
if error == 1 then
text = "Unknown command."
elseif error == 2 then
text = "A staff level of '"..Roles[level].."' is required to use this command."
elseif error == 3 then
text = "Invalid command arguments."
elseif error == 4 then
text = "The given argument either does not exist or it is invalid."
elseif error == 5 then
text = "You may not use this command on yourself."
elseif error == 6 then
text = "You may not use this command in this area."
elseif error == 7 then
text = "The player stated is already dead."
else
text = "Unknown exception has occured."
end
HUDMsg(id, text, "error")
end
function FixArgument(text, num)
local arg = ""
for k, v in ipairs(text:split(' ')) do
if k >= num then
arg = arg..' '..v
end
end
return arg
end
function ValidArgument(arg)
if arg and arg ~= "" then
return true
end
return false
end
function ToTable(t, match)
local cmd = {}
if not match then match = "[^%s]+" end
for word in string.gmatch(t, match) do
table.insert(cmd, word)
end
return cmd
end
That's a lot of codes for command !kick only XD, it even has own admin detector
【=◈︿◈=】
Thank you both of you but i want to add these things in my code
I will be very thankful you if u will add these things in my code
Just add system if i use command on myself to show msg
"You can not punish yourself"
and if <reason> is missing then show
"Please enter a reason"
Just add in my commands
I will be very thankful you if u will add these things in my code
Just add system if i use command on myself to show msg
"You can not punish yourself"
and if <reason> is missing then show
"Please enter a reason"
Just add in my commands

Which then of the favors of your lord will you deny?



