core/sm_srvcmds.h
author Phong Dang <teame06@gmail.com>
Wed Aug 01 07:29:40 2007 +0000 (2007-08-01)
changeset 1241 2e8046793bc9
parent 1231 17badaf66ce4
child 1330 ab94316bb52b
permissions -rw-r--r--
Added check to make sure player are alive to perform sm_slap, sm_burn, sm_slay.
dvander@370
     1
/**
ds@653
     2
 * vim: set ts=4 :
dvander@1231
     3
 * ================================================================
dvander@1231
     4
 * SourceMod
dvander@1231
     5
 * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
dvander@1231
     6
 * ================================================================
dvander@370
     7
 *
dvander@1231
     8
 * This program is free software; you can redistribute it and/or 
dvander@1231
     9
 * modify it under the terms of the GNU General Public License, 
dvander@1231
    10
 * version 3.0, as published by the Free Software Foundation.
dvander@1231
    11
 * 
dvander@1231
    12
 * This program is distributed in the hope that it will be useful,
dvander@1231
    13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
dvander@1231
    14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dvander@1231
    15
 * GNU General Public License for more details.
dvander@1231
    16
 *
dvander@1231
    17
 * You should have received a copy of the GNU General Public License
dvander@1231
    18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
dvander@1231
    19
 *
dvander@1231
    20
 * As a special exception, AlliedModders LLC gives you permission to 
dvander@1231
    21
 * link the code of this program (as well as its derivative works) to 
dvander@1231
    22
 * "Half-Life 2," the "Source Engine," the "SourcePawn JIT," and any 
dvander@1231
    23
 * Game MODs that run on software by the Valve Corporation.  You must 
dvander@1231
    24
 * obey the GNU General Public License in all respects for all other 
dvander@1231
    25
 * code used. Additionally, AlliedModders LLC grants this exception 
dvander@1231
    26
 * to all derivative works. AlliedModders LLC defines further 
dvander@1231
    27
 * exceptions, found in LICENSE.txt (as of this writing, version 
dvander@1231
    28
 * JULY-31-2007), or <http://www.sourcemod.net/license.php>.
dvander@370
    29
 *
dvander@370
    30
 * Version: $Id$
dvander@370
    31
 */
dvander@370
    32
dvander@223
    33
#ifndef _INCLUDE_SOURCEMOD_SERVERCOMMANDS_H_
dvander@223
    34
#define _INCLUDE_SOURCEMOD_SERVERCOMMANDS_H_
dvander@223
    35
dvander@223
    36
#include "sourcemod.h"
dvander@308
    37
#include <IRootConsoleMenu.h>
dvander@223
    38
#include "PluginSys.h"
faluco@216
    39
#include "sourcemm_api.h"
dvander@308
    40
#include <sh_list.h>
dvander@308
    41
#include <sh_string.h>
dvander@308
    42
#include "sm_trie.h"
faluco@216
    43
faluco@216
    44
using namespace SourceMod;
dvander@308
    45
using namespace SourceHook;
faluco@216
    46
dvander@308
    47
struct ConsoleEntry
faluco@216
    48
{
dvander@308
    49
	String command;
dvander@308
    50
	String description;
dvander@223
    51
};
dvander@223
    52
dvander@308
    53
class RootConsoleMenu : 
dvander@308
    54
	public IConCommandBaseAccessor,
dvander@308
    55
	public SMGlobalClass,
dvander@308
    56
	public IRootConsoleCommand,
dvander@308
    57
	public IRootConsole
dvander@308
    58
{
dvander@308
    59
public:
dvander@308
    60
	RootConsoleMenu();
dvander@308
    61
	~RootConsoleMenu();
dvander@308
    62
public: //IConCommandBaseAccessor
dvander@308
    63
	bool RegisterConCommandBase(ConCommandBase *pCommand);
dvander@308
    64
public: //SMGlobalClass
dvander@308
    65
	void OnSourceModStartup(bool late);
dvander@308
    66
	void OnSourceModShutdown();
dvander@308
    67
public: //IRootConsoleCommand
dvander@308
    68
	void OnRootConsoleCommand(const char *cmd, unsigned int argcount);
dvander@308
    69
public: //IRootConsole
dvander@308
    70
	bool AddRootConsoleCommand(const char *cmd, const char *text, IRootConsoleCommand *pHandler);
dvander@308
    71
	bool RemoveRootConsoleCommand(const char *cmd, IRootConsoleCommand *pHandler);
dvander@308
    72
	void ConsolePrint(const char *fmt, ...);
dvander@308
    73
	const char *GetArgument(unsigned int argno);
dvander@308
    74
	unsigned int GetArgumentCount();
dvander@308
    75
	const char *GetArguments();
dvander@309
    76
	void DrawGenericOption(const char *cmd, const char *text);
dvander@308
    77
public:
dvander@308
    78
	void GotRootCmd();
dvander@308
    79
private:
dvander@978
    80
	bool m_CfgExecDone;
dvander@308
    81
	Trie *m_pCommands;
dvander@308
    82
	List<ConsoleEntry *> m_Menu;
dvander@308
    83
};
dvander@308
    84
dvander@308
    85
extern RootConsoleMenu g_RootMenu;
dvander@308
    86
dvander@223
    87
#endif //_INCLUDE_SOURCEMOD_SERVERCOMMANDS_H_