ds@1952: /** ds@1952: * vim: set ts=4 : ds@1952: * ============================================================================= ds@1952: * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved. ds@1952: * ============================================================================= ds@1952: * ds@1952: * This file is part of the SourceMod/SourcePawn SDK. ds@1952: * ds@1952: * This program is free software; you can redistribute it and/or modify it under ds@1952: * the terms of the GNU General Public License, version 3.0, as published by the ds@1952: * Free Software Foundation. ds@1952: * ds@1952: * This program is distributed in the hope that it will be useful, but WITHOUT ds@1952: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ds@1952: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ds@1952: * details. ds@1952: * ds@1952: * You should have received a copy of the GNU General Public License along with ds@1952: * this program. If not, see . ds@1952: * ds@1952: * As a special exception, AlliedModders LLC gives you permission to link the ds@1952: * code of this program (as well as its derivative works) to "Half-Life 2," the ds@1952: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software ds@1952: * by the Valve Corporation. You must obey the GNU General Public License in ds@1952: * all respects for all other code used. Additionally, AlliedModders LLC grants ds@1952: * this exception to all derivative works. AlliedModders LLC defines further ds@1952: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), ds@1952: * or . ds@1952: * ds@1952: * Version: $Id$ ds@1952: */ ds@1952: ds@1952: #if defined _adminmenu_included ds@1952: #endinput ds@1952: #endif ds@1952: #define _adminmenu_included ds@1952: ds@1952: /* Decide whether topmenus should be required */ ds@1952: #if !defined REQUIRE_PLUGIN ds@1952: #if defined REQUIRE_EXTENSIONS ds@1952: #define TEMP_REQUIRE_EXTENSIONS ds@1952: #undef REQUIRE_EXTENSIONS ds@1952: #endif ds@1952: ds@1952: #include ds@1952: ds@1952: /* Restore old REQUIRE_EXTENSIONS value if necessary */ ds@1952: #if defined TEMP_REQUIRE_EXTENSIONS ds@1952: #define REQUIRE_EXTENSIONS ds@1952: #undef TEMP_REQUIRE_EXTENSIONS ds@1952: #endif ds@1952: ds@1952: /** Category for player commands. */ ds@1952: #define ADMINMENU_PLAYERCOMMANDS "PlayerCommands" ds@1952: /** Category for server commands. */ ds@1952: #define ADMINMENU_SERVERCOMMANDS "ServerCommands" ds@1952: /** Category for voting commands. */ ds@1952: #define ADMINMENU_VOTINGCOMMANDS "VotingCommands" ds@1952: ds@1952: /** ds@1952: * Called when the admin menu is created and 3rd party plugins can grab ds@1952: * the Handle or add categories. ds@1952: * ds@1952: * @param topmenu Handle to the admin menu's TopMenu. ds@1952: * @noreturn ds@1952: */ ds@1952: forward OnAdminMenuCreated(Handle:topmenu); ds@1952: ds@1952: /** ds@1952: * Called when the admin menu is ready to have items added. ds@1952: * ds@1952: * @param topmenu Handle to the admin menu's TopMenu. ds@1952: * @noreturn ds@1952: */ ds@1952: forward OnAdminMenuReady(Handle:topmenu); ds@1952: ds@1952: /** ds@1952: * Retrieves the Handle to the admin top menu. ds@1952: * ds@1952: * @return Handle to the admin menu's TopMenu, ds@1952: * or INVALID_HANDLE if not created yet. ds@1952: */ ds@1952: native Handle:GetAdminTopMenu(); ds@1952: ds@1952: /** ds@1952: * Adds targets to an admin menu. ds@1952: * ds@1952: * Each client is displayed as: name (userid) ds@1952: * Each item contains the userid as a string for its info. ds@1952: * ds@1952: * @param menu Menu Handle. ds@1952: * @param source_client Source client, or 0 to ignore immunity. ds@1952: * @param in_game_only True to only select in-game players. ds@1952: * @param alive_only True to only select alive players. ds@1952: * @return Number of clients added. ds@1952: */ ds@1952: native AddTargetsToMenu(Handle:menu, ds@1952: source_client, ds@1952: bool:in_game_only=true, ds@1952: bool:alive_only=false); ds@1952: ds@1952: /** ds@1952: * Adds targets to an admin menu. ds@1952: * ds@1952: * Each client is displayed as: name (userid) ds@1952: * Each item contains the userid as a string for its info. ds@1952: * ds@1952: * @param menu Menu Handle. ds@1952: * @param source_client Source client, or 0 to ignore immunity. ds@1952: * @param flags COMMAND_FILTER flags from commandfilters.inc. ds@1952: * @return Number of clients added. ds@1952: */ ds@1952: native AddTargetsToMenu2(Handle:menu, source_client, flags); ds@1952: ds@1952: /** ds@1952: * Re-displays the admin menu to a client after selecting an item. ds@1952: * Auto-aborts if the Handle is invalid. ds@1952: * ds@1952: * @param topmenu TopMenu Handle. ds@1952: * @param client Client index. ds@1952: * @return True on success, false on failure. ds@1952: */ ds@1952: stock bool:RedisplayAdminMenu(Handle:topmenu, client) ds@1952: { ds@1952: if (topmenu == INVALID_HANDLE) ds@1952: { ds@1952: return false; ds@1952: } ds@1952: ds@1952: return DisplayTopMenu(topmenu, client, TopMenuPosition_LastCategory); ds@1952: } ds@1952: ds@1952: /* DO NOT EDIT BELOW THIS LINE */ ds@1952: ds@1952: public SharedPlugin:__pl_adminmenu = ds@1952: { ds@1952: name = "adminmenu", ds@1952: file = "adminmenu.smx", ds@1952: #if defined REQUIRE_PLUGIN ds@1952: required = 1, ds@1952: #else ds@1952: required = 0, ds@1952: #endif ds@1952: }; ds@1952: ds@1952: #if !defined REQUIRE_PLUGIN ds@1952: public __pl_adminmenu_SetNTVOptional() ds@1952: { ds@1952: MarkNativeAsOptional("GetAdminTopMenu"); ds@1952: MarkNativeAsOptional("AddTargetsToMenu"); ds@1952: MarkNativeAsOptional("AddTargetsToMenu2"); ds@1952: } ds@1952: #endif