3 * ===============================================================
4 * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
5 * ===============================================================
7 * This file is not open source and may not be copied without explicit
8 * written permission of AlliedModders LLC. This file may not be redistributed
9 * in whole or significant part.
10 * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
15 #ifndef _INCLUDE_SOURCEMOD_CCONCMDMANAGER_H_
16 #define _INCLUDE_SOURCEMOD_CCONCMDMANAGER_H_
18 #include "sm_globals.h"
19 #include "sourcemm_api.h"
20 #include "ForwardSys.h"
23 #include <IRootConsoleMenu.h>
25 using namespace SourceHook;
43 bool sourceMod; /**< Determines whether or not concmd was created by a SourceMod plugin */
44 ConCommand *pCmd; /**< Pointer to the command itself */
45 IChangeableForward *srvhooks; /**< Hooks on this name as a server command */
46 IChangeableForward *conhooks; /**< Hooks on this name as a console command */
49 class CConCmdManager :
51 public IRootConsoleCommand,
52 public IPluginsListener
54 friend void CommandCallback();
58 public: //SMGlobalClass
59 void OnSourceModAllInitialized();
60 void OnSourceModShutdown();
61 public: //IPluginsListener
62 void OnPluginLoaded(IPlugin *plugin);
63 void OnPluginDestroyed(IPlugin *plugin);
64 public: //IRootConsoleCommand
65 void OnRootConsoleCommand(const char *command, unsigned int argcount);
67 void AddServerCommand(IPluginFunction *pFunction, const char *name, const char *description, int flags);
68 void AddConsoleCommand(IPluginFunction *pFunction, const char *name, const char *description, int flags);
69 ResultType DispatchClientCommand(int client, ResultType type);
71 void InternalDispatch();
72 ConCmdInfo *AddOrFindCommand(const char *name, const char *description, int flags);
73 void SetCommandClient(int client);
74 void AddToCmdList(ConCmdInfo *info);
75 void RemoveConCmd(ConCmdInfo *info);
78 List<ConCmdInfo *> m_CmdList;
82 extern CConCmdManager g_ConCmds;
84 #endif // _INCLUDE_SOURCEMOD_CCONCMDMANAGER_H_