1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/plugins/slapslay.sp Wed Dec 19 01:16:15 2007 +0000
1.3 @@ -0,0 +1,103 @@
1.4 +/**
1.5 + * vim: set ts=4 :
1.6 + * =============================================================================
1.7 + * SourceMod SlapSlay Commands Plugin
1.8 + * Implements slap and slay commands
1.9 + *
1.10 + * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
1.11 + * =============================================================================
1.12 + *
1.13 + * This program is free software; you can redistribute it and/or modify it under
1.14 + * the terms of the GNU General Public License, version 3.0, as published by the
1.15 + * Free Software Foundation.
1.16 + *
1.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
1.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.19 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
1.20 + * details.
1.21 + *
1.22 + * You should have received a copy of the GNU General Public License along with
1.23 + * this program. If not, see <http://www.gnu.org/licenses/>.
1.24 + *
1.25 + * As a special exception, AlliedModders LLC gives you permission to link the
1.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
1.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
1.28 + * by the Valve Corporation. You must obey the GNU General Public License in
1.29 + * all respects for all other code used. Additionally, AlliedModders LLC grants
1.30 + * this exception to all derivative works. AlliedModders LLC defines further
1.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
1.32 + * or <http://www.sourcemod.net/license.php>.
1.33 + *
1.34 + * Version: $Id$
1.35 + */
1.36 +
1.37 +#pragma semicolon 1
1.38 +
1.39 +#include <sourcemod>
1.40 +#include <sdktools>
1.41 +#undef REQUIRE_PLUGIN
1.42 +#include <adminmenu>
1.43 +
1.44 +public Plugin:myinfo =
1.45 +{
1.46 + name = "SlapSlay Commands",
1.47 + author = "AlliedModders LLC",
1.48 + description = "Slap and Slay Commands",
1.49 + version = SOURCEMOD_VERSION,
1.50 + url = "http://www.sourcemod.net/"
1.51 +};
1.52 +
1.53 +new Handle:hTopMenu = INVALID_HANDLE;
1.54 +
1.55 +#include "basefuncommands/slay.sp"
1.56 +#include "basefuncommands/slap.sp"
1.57 +
1.58 +public OnPluginStart()
1.59 +{
1.60 + LoadTranslations("common.phrases");
1.61 + LoadTranslations("slapslay.phrases");
1.62 +
1.63 + RegAdminCmd("sm_slap", Command_Slap, ADMFLAG_SLAY, "sm_slap <#userid|name> [damage]");
1.64 + RegAdminCmd("sm_slay", Command_Slay, ADMFLAG_SLAY, "sm_slay <#userid|name>");
1.65 +
1.66 + /* Account for late loading */
1.67 + new Handle:topmenu;
1.68 + if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
1.69 + {
1.70 + OnAdminMenuReady(topmenu);
1.71 + }
1.72 +}
1.73 +
1.74 +public OnAdminMenuReady(Handle:topmenu)
1.75 +{
1.76 + /* Block us from being called twice */
1.77 + if (topmenu == hTopMenu)
1.78 + {
1.79 + return;
1.80 + }
1.81 +
1.82 + /* Save the Handle */
1.83 + hTopMenu = topmenu;
1.84 +
1.85 + /* Find the "Player Commands" category */
1.86 + new TopMenuObject:player_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_PLAYERCOMMANDS);
1.87 +
1.88 + if (player_commands != INVALID_TOPMENUOBJECT)
1.89 + {
1.90 + AddToTopMenu(hTopMenu,
1.91 + "sm_slay",
1.92 + TopMenuObject_Item,
1.93 + AdminMenu_Slay,
1.94 + player_commands,
1.95 + "sm_slay",
1.96 + ADMFLAG_SLAY);
1.97 +
1.98 + AddToTopMenu(hTopMenu,
1.99 + "sm_slap",
1.100 + TopMenuObject_Item,
1.101 + AdminMenu_Slap,
1.102 + player_commands,
1.103 + "sm_slap",
1.104 + ADMFLAG_SLAY);
1.105 + }
1.106 +}
1.107 \ No newline at end of file