1
0

InfoReg uses cCompositeChat for subcommand lists.

Also fixed an issue with console commands.
This commit is contained in:
madmaxoft 2014-04-07 15:47:42 +02:00
parent b45e8a8bd9
commit 8c7d0f5304

View File

@ -16,22 +16,22 @@ local function ListSubcommands(a_Player, a_Subcommands, a_CmdString)
end end
-- Enum all the subcommands: -- Enum all the subcommands:
local Verbs = {}; local Verbs = {}
for cmd, info in pairs(a_Subcommands) do for cmd, info in pairs(a_Subcommands) do
if (a_Player:HasPermission(info.Permission or "")) then if ((a_Player == nil) or (a_Player:HasPermission(info.Permission or ""))) then
table.insert(Verbs, " " .. a_CmdString .. " " .. cmd); table.insert(Verbs, a_CmdString .. " " .. cmd)
end end
end end
table.sort(Verbs); table.sort(Verbs)
-- Send the list: -- Send the list:
if (a_Player == nil) then if (a_Player == nil) then
for idx, verb in ipairs(Verbs) do for idx, verb in ipairs(Verbs) do
LOGINFO(verb); LOGINFO(" " .. verb)
end end
else else
for idx, verb in ipairs(Verbs) do for idx, verb in ipairs(Verbs) do
a_Player:SendMessage(verb); a_Player:SendMessage(cCompositeChat(" ", mtInfo):AddSuggestCommandPart(verb, verb))
end end
end end
end end