added per-plugin command listing
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40505
This commit is contained in:
parent
165b705354
commit
dcb10ee3a2
@ -266,4 +266,56 @@ ConCmdInfo *CConCmdManager::AddOrFindCommand(const char *name, const char *descr
|
|||||||
|
|
||||||
void CConCmdManager::OnRootConsoleCommand(const char *command, unsigned int argcount)
|
void CConCmdManager::OnRootConsoleCommand(const char *command, unsigned int argcount)
|
||||||
{
|
{
|
||||||
|
if (argcount >= 3)
|
||||||
|
{
|
||||||
|
const char *text = engine->Cmd_Argv(2);
|
||||||
|
int id = atoi(text);
|
||||||
|
CPlugin *pPlugin = g_PluginSys.GetPluginByOrder(id);
|
||||||
|
|
||||||
|
if (!pPlugin)
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Plugin index %d not found.", id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CmdList *pList;
|
||||||
|
if (!pPlugin->GetProperty("CommandList", (void **)&pList))
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] No commands found for %s", pPlugin->GetFilename());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!pList->size())
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] No commands found for %s", pPlugin->GetFilename());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CmdList::iterator iter;
|
||||||
|
const char *type = NULL;
|
||||||
|
const char *name;
|
||||||
|
const char *help;
|
||||||
|
g_RootMenu.ConsolePrint(" %-17.16s %-8.7s %s", "[Name]", "[Type]", "[Help]");
|
||||||
|
for (iter=pList->begin();
|
||||||
|
iter!=pList->end();
|
||||||
|
iter++)
|
||||||
|
{
|
||||||
|
PlCmdInfo &cmd = (*iter);
|
||||||
|
if (cmd.type == Cmd_Server)
|
||||||
|
{
|
||||||
|
type = "server";
|
||||||
|
} else if (cmd.type == Cmd_Console) {
|
||||||
|
type = "console";
|
||||||
|
} else if (cmd.type == Cmd_Client) {
|
||||||
|
type = "client";
|
||||||
|
}
|
||||||
|
name = cmd.pInfo->pCmd->GetName();
|
||||||
|
help = cmd.pInfo->pCmd->GetHelpText();
|
||||||
|
g_RootMenu.ConsolePrint(" %-17.16s %-12.11s %s", name, type, help);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Usage: sm cmds <plugin #>");
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ void CConVarManager::OnRootConsoleCommand(const char *command, unsigned int argc
|
|||||||
// If invalid plugin index...
|
// If invalid plugin index...
|
||||||
if (num < 1 || num > (int)g_PluginSys.GetPluginCount())
|
if (num < 1 || num > (int)g_PluginSys.GetPluginCount())
|
||||||
{
|
{
|
||||||
g_RootMenu.ConsolePrint("[SM] Plugin index not found.");
|
g_RootMenu.ConsolePrint("[SM] Plugin index %d not found.", num);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ void CConVarManager::OnRootConsoleCommand(const char *command, unsigned int argc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Display usage of subcommand
|
// Display usage of subcommand
|
||||||
g_RootMenu.ConsolePrint("[SM] Usage: sm convars <#>");
|
g_RootMenu.ConsolePrint("[SM] Usage: sm convars <plugin #>");
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle_t CConVarManager::CreateConVar(IPluginContext *pContext, const char *name, const char *defaultVal, const char *helpText, int flags, bool hasMin, float min, bool hasMax, float max)
|
Handle_t CConVarManager::CreateConVar(IPluginContext *pContext, const char *name, const char *defaultVal, const char *helpText, int flags, bool hasMin, float min, bool hasMax, float max)
|
||||||
|
Loading…
Reference in New Issue
Block a user