-
Notifications
You must be signed in to change notification settings - Fork 41
/
cmd_listgroups.lua
27 lines (21 loc) · 828 Bytes
/
cmd_listgroups.lua
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
function HandleListGroupsCommand(Split, Player)
local Response
if Split[3] then
return true, SendMessage("Usage: " .. Split[1] .. " [rank]")
end
-- If no params are given, list all groups that the manager knows:
local RankName = Split[2]
if not RankName then
-- Get all the groups:
local Groups = cRankManager:GetAllGroups()
Response = SendMessage(Player, "Available groups: " .. table.concat(Groups, ", ") .. " (total: " .. #Groups .. ")")
else
-- A rank name is given, list the groups in that rank:
local Groups = cRankManager:GetRankGroups(RankName)
Response = SendMessage(Player, "Groups in rank " .. RankName .. ": " .. table.concat(Groups, ", ") .. " (total: " .. #Groups .. ")")
end
return true, Response
end
function HandleConsoleListGroups(Split)
return HandleListGroupsCommand(Split)
end