renamed slapslay to playercommands
authorDavid Anderson <dvander@alliedmods.net>
Wed Dec 19 01:34:01 2007 +0000 (2007-12-19)
changeset 1803f401d4b85215
parent 1802 05d54accf5c0
child 1804 51f5934a73a3
renamed slapslay to playercommands
plugins/playercommands.sp
plugins/playercommands/slap.sp
plugins/playercommands/slay.sp
plugins/slapslay.sp
plugins/slapslay/slap.sp
plugins/slapslay/slay.sp
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/plugins/playercommands.sp	Wed Dec 19 01:34:01 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 "playercommands/slay.sp"
    1.56 +#include "playercommands/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
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/plugins/playercommands/slap.sp	Wed Dec 19 01:34:01 2007 +0000
     2.3 @@ -0,0 +1,217 @@
     2.4 +/**
     2.5 + * vim: set ts=4 :
     2.6 + * =============================================================================
     2.7 + * SourceMod Basefuncommands Plugin
     2.8 + * Provides slap functionality
     2.9 + *
    2.10 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
    2.11 + * =============================================================================
    2.12 + *
    2.13 + * This program is free software; you can redistribute it and/or modify it under
    2.14 + * the terms of the GNU General Public License, version 3.0, as published by the
    2.15 + * Free Software Foundation.
    2.16 + * 
    2.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
    2.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    2.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    2.20 + * details.
    2.21 + *
    2.22 + * You should have received a copy of the GNU General Public License along with
    2.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
    2.24 + *
    2.25 + * As a special exception, AlliedModders LLC gives you permission to link the
    2.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
    2.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    2.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
    2.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
    2.30 + * this exception to all derivative works.  AlliedModders LLC defines further
    2.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    2.32 + * or <http://www.sourcemod.net/license.php>.
    2.33 + *
    2.34 + * Version: $Id$
    2.35 + */
    2.36 + 
    2.37 +new g_SlapDamage[MAXPLAYERS+1];
    2.38 +
    2.39 +PerformSlap(client, target, damage)
    2.40 +{
    2.41 +	LogAction(client, target, "\"%L\" slapped \"%L\" (damage \"%d\")", client, target, damage);
    2.42 +	SlapPlayer(target, damage, true);
    2.43 +}
    2.44 +
    2.45 +DisplaySlapDamageMenu(client)
    2.46 +{
    2.47 +	new Handle:menu = CreateMenu(MenuHandler_SlapDamage);
    2.48 +	
    2.49 +	decl String:title[100];
    2.50 +	Format(title, sizeof(title), "%T:", "Slap damage", client);
    2.51 +	SetMenuTitle(menu, title);
    2.52 +	SetMenuExitBackButton(menu, true);
    2.53 +	
    2.54 +	AddMenuItem(menu, "0", "0");
    2.55 +	AddMenuItem(menu, "1", "1");
    2.56 +	AddMenuItem(menu, "5", "5");
    2.57 +	AddMenuItem(menu, "10", "10");
    2.58 +	AddMenuItem(menu, "20", "20");
    2.59 +	AddMenuItem(menu, "50", "50");
    2.60 +	AddMenuItem(menu, "99", "99");
    2.61 +	
    2.62 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
    2.63 +}
    2.64 +
    2.65 +DisplaySlapTargetMenu(client)
    2.66 +{
    2.67 +	new Handle:menu = CreateMenu(MenuHandler_Slap);
    2.68 +	
    2.69 +	decl String:title[100];
    2.70 +	Format(title, sizeof(title), "%T:", "Slap player", client);
    2.71 +	SetMenuTitle(menu, title);
    2.72 +	SetMenuExitBackButton(menu, true);
    2.73 +	
    2.74 +	AddTargetsToMenu(menu, client, true, true);
    2.75 +	
    2.76 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
    2.77 +}
    2.78 +
    2.79 +public AdminMenu_Slap(Handle:topmenu, 
    2.80 +					  TopMenuAction:action,
    2.81 +					  TopMenuObject:object_id,
    2.82 +					  param,
    2.83 +					  String:buffer[],
    2.84 +					  maxlength)
    2.85 +{
    2.86 +	if (action == TopMenuAction_DisplayOption)
    2.87 +	{
    2.88 +		Format(buffer, maxlength, "%T", "Slap player", param);
    2.89 +	}
    2.90 +	else if (action == TopMenuAction_SelectOption)
    2.91 +	{
    2.92 +		DisplaySlapDamageMenu(param);
    2.93 +	}
    2.94 +}
    2.95 +
    2.96 +public MenuHandler_SlapDamage(Handle:menu, MenuAction:action, param1, param2)
    2.97 +{
    2.98 +	if (action == MenuAction_End)
    2.99 +	{
   2.100 +		CloseHandle(menu);
   2.101 +	}
   2.102 +	else if (action == MenuAction_Cancel)
   2.103 +	{
   2.104 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   2.105 +		{
   2.106 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   2.107 +		}
   2.108 +	}
   2.109 +	else if (action == MenuAction_Select)
   2.110 +	{
   2.111 +		decl String:info[32];
   2.112 +		
   2.113 +		GetMenuItem(menu, param2, info, sizeof(info));
   2.114 +		g_SlapDamage[param1] = StringToInt(info);
   2.115 +		
   2.116 +		DisplaySlapTargetMenu(param1);
   2.117 +	}
   2.118 +}
   2.119 +
   2.120 +public MenuHandler_Slap(Handle:menu, MenuAction:action, param1, param2)
   2.121 +{
   2.122 +	if (action == MenuAction_End)
   2.123 +	{
   2.124 +		CloseHandle(menu);
   2.125 +	}
   2.126 +	else if (action == MenuAction_Cancel)
   2.127 +	{
   2.128 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   2.129 +		{
   2.130 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   2.131 +		}
   2.132 +	}
   2.133 +	else if (action == MenuAction_Select)
   2.134 +	{
   2.135 +		decl String:info[32];
   2.136 +		new userid, target;
   2.137 +		
   2.138 +		GetMenuItem(menu, param2, info, sizeof(info));
   2.139 +		userid = StringToInt(info);
   2.140 +
   2.141 +		if ((target = GetClientOfUserId(userid)) == 0)
   2.142 +		{
   2.143 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
   2.144 +		}
   2.145 +		else if (!CanUserTarget(param1, target))
   2.146 +		{
   2.147 +			PrintToChat(param1, "[SM] %t", "Unable to target");
   2.148 +		}
   2.149 +		else if (!IsPlayerAlive(target))
   2.150 +		{
   2.151 +			ReplyToCommand(param1, "[SM] %t", "Player has since died");
   2.152 +		}	
   2.153 +		else
   2.154 +		{
   2.155 +			decl String:name[32];
   2.156 +			GetClientName(target, name, sizeof(name));
   2.157 +			PerformSlap(param1, target, g_SlapDamage[param1]);
   2.158 +			ShowActivity2(param1, "[SM] ", "%t", "Slapped target", "_s", name);
   2.159 +		}
   2.160 +		
   2.161 +		DisplaySlapTargetMenu(param1);
   2.162 +	}
   2.163 +}
   2.164 +
   2.165 +public Action:Command_Slap(client, args)
   2.166 +{
   2.167 +	if (args < 1)
   2.168 +	{
   2.169 +		ReplyToCommand(client, "[SM] Usage: sm_slap <#userid|name> [damage]");
   2.170 +		return Plugin_Handled;
   2.171 +	}
   2.172 +
   2.173 +	decl String:arg[65];
   2.174 +	GetCmdArg(1, arg, sizeof(arg));
   2.175 +
   2.176 +	new damage = 0;
   2.177 +	if (args > 1)
   2.178 +	{
   2.179 +		decl String:arg2[20];
   2.180 +		GetCmdArg(2, arg2, sizeof(arg2));
   2.181 +		if (StringToIntEx(arg2, damage) == 0)
   2.182 +		{
   2.183 +			ReplyToCommand(client, "[SM] %t", "Invalid Amount");
   2.184 +			return Plugin_Handled;
   2.185 +		}
   2.186 +	}
   2.187 +	
   2.188 +	decl String:target_name[MAX_TARGET_LENGTH];
   2.189 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   2.190 +	
   2.191 +	if ((target_count = ProcessTargetString(
   2.192 +			arg,
   2.193 +			client,
   2.194 +			target_list,
   2.195 +			MAXPLAYERS,
   2.196 +			COMMAND_FILTER_ALIVE,
   2.197 +			target_name,
   2.198 +			sizeof(target_name),
   2.199 +			tn_is_ml)) <= 0)
   2.200 +	{
   2.201 +		ReplyToTargetError(client, target_count);
   2.202 +		return Plugin_Handled;
   2.203 +	}
   2.204 +	
   2.205 +	for (new i = 0; i < target_count; i++)
   2.206 +	{
   2.207 +		PerformSlap(client, target_list[i], damage);
   2.208 +	}
   2.209 +
   2.210 +	if (tn_is_ml)
   2.211 +	{
   2.212 +		ShowActivity2(client, "[SM] ", "%t", "Slapped target", target_name);
   2.213 +	}
   2.214 +	else
   2.215 +	{
   2.216 +		ShowActivity2(client, "[SM] ", "%t", "Slapped target", "_s", target_name);
   2.217 +	}
   2.218 +
   2.219 +	return Plugin_Handled;
   2.220 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/plugins/playercommands/slay.sp	Wed Dec 19 01:34:01 2007 +0000
     3.3 @@ -0,0 +1,159 @@
     3.4 +/**
     3.5 + * vim: set ts=4 :
     3.6 + * =============================================================================
     3.7 + * SourceMod Basefuncommands Plugin
     3.8 + * Provides slay functionality
     3.9 + *
    3.10 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
    3.11 + * =============================================================================
    3.12 + *
    3.13 + * This program is free software; you can redistribute it and/or modify it under
    3.14 + * the terms of the GNU General Public License, version 3.0, as published by the
    3.15 + * Free Software Foundation.
    3.16 + * 
    3.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
    3.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    3.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    3.20 + * details.
    3.21 + *
    3.22 + * You should have received a copy of the GNU General Public License along with
    3.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
    3.24 + *
    3.25 + * As a special exception, AlliedModders LLC gives you permission to link the
    3.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
    3.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    3.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
    3.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
    3.30 + * this exception to all derivative works.  AlliedModders LLC defines further
    3.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    3.32 + * or <http://www.sourcemod.net/license.php>.
    3.33 + *
    3.34 + * Version: $Id$
    3.35 + */
    3.36 +
    3.37 +PerformSlay(client, target)
    3.38 +{
    3.39 +	LogAction(client, target, "\"%L\" slayed \"%L\"", client, target);
    3.40 +	ForcePlayerSuicide(target);
    3.41 +}
    3.42 +
    3.43 +DisplaySlayMenu(client)
    3.44 +{
    3.45 +	new Handle:menu = CreateMenu(MenuHandler_Slay);
    3.46 +	
    3.47 +	decl String:title[100];
    3.48 +	Format(title, sizeof(title), "%T:", "Slay player", client);
    3.49 +	SetMenuTitle(menu, title);
    3.50 +	SetMenuExitBackButton(menu, true);
    3.51 +	
    3.52 +	AddTargetsToMenu(menu, client, true, true);
    3.53 +	
    3.54 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
    3.55 +}
    3.56 +
    3.57 +public AdminMenu_Slay(Handle:topmenu, 
    3.58 +					  TopMenuAction:action,
    3.59 +					  TopMenuObject:object_id,
    3.60 +					  param,
    3.61 +					  String:buffer[],
    3.62 +					  maxlength)
    3.63 +{
    3.64 +	if (action == TopMenuAction_DisplayOption)
    3.65 +	{
    3.66 +		Format(buffer, maxlength, "%T", "Slay player", param);
    3.67 +	}
    3.68 +	else if (action == TopMenuAction_SelectOption)
    3.69 +	{
    3.70 +		DisplaySlayMenu(param);
    3.71 +	}
    3.72 +}
    3.73 +
    3.74 +public MenuHandler_Slay(Handle:menu, MenuAction:action, param1, param2)
    3.75 +{
    3.76 +	if (action == MenuAction_End)
    3.77 +	{
    3.78 +		CloseHandle(menu);
    3.79 +	}
    3.80 +	else if (action == MenuAction_Cancel)
    3.81 +	{
    3.82 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
    3.83 +		{
    3.84 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
    3.85 +		}
    3.86 +	}
    3.87 +	else if (action == MenuAction_Select)
    3.88 +	{
    3.89 +		decl String:info[32];
    3.90 +		new userid, target;
    3.91 +		
    3.92 +		GetMenuItem(menu, param2, info, sizeof(info));
    3.93 +		userid = StringToInt(info);
    3.94 +
    3.95 +		if ((target = GetClientOfUserId(userid)) == 0)
    3.96 +		{
    3.97 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
    3.98 +		}
    3.99 +		else if (!CanUserTarget(param1, target))
   3.100 +		{
   3.101 +			PrintToChat(param1, "[SM] %t", "Unable to target");
   3.102 +		}
   3.103 +		else if (!IsPlayerAlive(target))
   3.104 +		{
   3.105 +			ReplyToCommand(param1, "[SM] %t", "Player has since died");
   3.106 +		}
   3.107 +		else
   3.108 +		{
   3.109 +			decl String:name[32];
   3.110 +			GetClientName(target, name, sizeof(name));
   3.111 +			PerformSlay(param1, target);
   3.112 +			ShowActivity2(param1, "[SM] ", "%t", "Slayed target", "_s", name);
   3.113 +		}
   3.114 +		
   3.115 +		DisplaySlayMenu(param1);
   3.116 +	}
   3.117 +}
   3.118 +
   3.119 +public Action:Command_Slay(client, args)
   3.120 +{
   3.121 +	if (args < 1)
   3.122 +	{
   3.123 +		ReplyToCommand(client, "[SM] Usage: sm_slay <#userid|name>");
   3.124 +		return Plugin_Handled;
   3.125 +	}
   3.126 +
   3.127 +	decl String:arg[65];
   3.128 +	GetCmdArg(1, arg, sizeof(arg));
   3.129 +
   3.130 +	decl String:target_name[MAX_TARGET_LENGTH];
   3.131 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   3.132 +	
   3.133 +	if ((target_count = ProcessTargetString(
   3.134 +			arg,
   3.135 +			client,
   3.136 +			target_list,
   3.137 +			MAXPLAYERS,
   3.138 +			COMMAND_FILTER_ALIVE,
   3.139 +			target_name,
   3.140 +			sizeof(target_name),
   3.141 +			tn_is_ml)) <= 0)
   3.142 +	{
   3.143 +		ReplyToTargetError(client, target_count);
   3.144 +		return Plugin_Handled;
   3.145 +	}
   3.146 +
   3.147 +	for (new i = 0; i < target_count; i++)
   3.148 +	{
   3.149 +		PerformSlay(client, target_list[i]);
   3.150 +	}
   3.151 +	
   3.152 +	if (tn_is_ml)
   3.153 +	{
   3.154 +		ShowActivity2(client, "[SM] ", "%t", "Slayed target", target_name);
   3.155 +	}
   3.156 +	else
   3.157 +	{
   3.158 +		ShowActivity2(client, "[SM] ", "%t", "Slayed target", "_s", target_name);
   3.159 +	}
   3.160 +
   3.161 +	return Plugin_Handled;
   3.162 +}
     4.1 --- a/plugins/slapslay.sp	Wed Dec 19 01:20:56 2007 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,103 +0,0 @@
     4.4 -/**
     4.5 - * vim: set ts=4 :
     4.6 - * =============================================================================
     4.7 - * SourceMod SlapSlay Commands Plugin
     4.8 - * Implements slap and slay commands
     4.9 - *
    4.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
    4.11 - * =============================================================================
    4.12 - *
    4.13 - * This program is free software; you can redistribute it and/or modify it under
    4.14 - * the terms of the GNU General Public License, version 3.0, as published by the
    4.15 - * Free Software Foundation.
    4.16 - * 
    4.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
    4.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    4.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    4.20 - * details.
    4.21 - *
    4.22 - * You should have received a copy of the GNU General Public License along with
    4.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
    4.24 - *
    4.25 - * As a special exception, AlliedModders LLC gives you permission to link the
    4.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
    4.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    4.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
    4.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
    4.30 - * this exception to all derivative works.  AlliedModders LLC defines further
    4.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    4.32 - * or <http://www.sourcemod.net/license.php>.
    4.33 - *
    4.34 - * Version: $Id$
    4.35 - */
    4.36 -
    4.37 -#pragma semicolon 1
    4.38 -
    4.39 -#include <sourcemod>
    4.40 -#include <sdktools>
    4.41 -#undef REQUIRE_PLUGIN
    4.42 -#include <adminmenu>
    4.43 -
    4.44 -public Plugin:myinfo =
    4.45 -{
    4.46 -	name = "SlapSlay Commands",
    4.47 -	author = "AlliedModders LLC",
    4.48 -	description = "Slap and Slay Commands",
    4.49 -	version = SOURCEMOD_VERSION,
    4.50 -	url = "http://www.sourcemod.net/"
    4.51 -};
    4.52 -
    4.53 -new Handle:hTopMenu = INVALID_HANDLE;
    4.54 -
    4.55 -#include "basefuncommands/slay.sp"
    4.56 -#include "basefuncommands/slap.sp"
    4.57 -
    4.58 -public OnPluginStart()
    4.59 -{
    4.60 -	LoadTranslations("common.phrases");
    4.61 -	LoadTranslations("slapslay.phrases");
    4.62 -
    4.63 -	RegAdminCmd("sm_slap", Command_Slap, ADMFLAG_SLAY, "sm_slap <#userid|name> [damage]");
    4.64 -	RegAdminCmd("sm_slay", Command_Slay, ADMFLAG_SLAY, "sm_slay <#userid|name>");
    4.65 -	
    4.66 -	/* Account for late loading */
    4.67 -	new Handle:topmenu;
    4.68 -	if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
    4.69 -	{
    4.70 -		OnAdminMenuReady(topmenu);
    4.71 -	}
    4.72 -}
    4.73 -
    4.74 -public OnAdminMenuReady(Handle:topmenu)
    4.75 -{
    4.76 -	/* Block us from being called twice */
    4.77 -	if (topmenu == hTopMenu)
    4.78 -	{
    4.79 -		return;
    4.80 -	}
    4.81 -	
    4.82 -	/* Save the Handle */
    4.83 -	hTopMenu = topmenu;
    4.84 -	
    4.85 -	/* Find the "Player Commands" category */
    4.86 -	new TopMenuObject:player_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_PLAYERCOMMANDS);
    4.87 -
    4.88 -	if (player_commands != INVALID_TOPMENUOBJECT)
    4.89 -	{
    4.90 -		AddToTopMenu(hTopMenu,
    4.91 -			"sm_slay",
    4.92 -			TopMenuObject_Item,
    4.93 -			AdminMenu_Slay,
    4.94 -			player_commands,
    4.95 -			"sm_slay",
    4.96 -			ADMFLAG_SLAY);
    4.97 -			
    4.98 -		AddToTopMenu(hTopMenu,
    4.99 -			"sm_slap",
   4.100 -			TopMenuObject_Item,
   4.101 -			AdminMenu_Slap,
   4.102 -			player_commands,
   4.103 -			"sm_slap",
   4.104 -			ADMFLAG_SLAY);	
   4.105 -	}
   4.106 -}
   4.107 \ No newline at end of file
     5.1 --- a/plugins/slapslay/slap.sp	Wed Dec 19 01:20:56 2007 +0000
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,217 +0,0 @@
     5.4 -/**
     5.5 - * vim: set ts=4 :
     5.6 - * =============================================================================
     5.7 - * SourceMod Basefuncommands Plugin
     5.8 - * Provides slap functionality
     5.9 - *
    5.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
    5.11 - * =============================================================================
    5.12 - *
    5.13 - * This program is free software; you can redistribute it and/or modify it under
    5.14 - * the terms of the GNU General Public License, version 3.0, as published by the
    5.15 - * Free Software Foundation.
    5.16 - * 
    5.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
    5.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    5.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    5.20 - * details.
    5.21 - *
    5.22 - * You should have received a copy of the GNU General Public License along with
    5.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
    5.24 - *
    5.25 - * As a special exception, AlliedModders LLC gives you permission to link the
    5.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
    5.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    5.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
    5.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
    5.30 - * this exception to all derivative works.  AlliedModders LLC defines further
    5.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    5.32 - * or <http://www.sourcemod.net/license.php>.
    5.33 - *
    5.34 - * Version: $Id$
    5.35 - */
    5.36 - 
    5.37 -new g_SlapDamage[MAXPLAYERS+1];
    5.38 -
    5.39 -PerformSlap(client, target, damage)
    5.40 -{
    5.41 -	LogAction(client, target, "\"%L\" slapped \"%L\" (damage \"%d\")", client, target, damage);
    5.42 -	SlapPlayer(target, damage, true);
    5.43 -}
    5.44 -
    5.45 -DisplaySlapDamageMenu(client)
    5.46 -{
    5.47 -	new Handle:menu = CreateMenu(MenuHandler_SlapDamage);
    5.48 -	
    5.49 -	decl String:title[100];
    5.50 -	Format(title, sizeof(title), "%T:", "Slap damage", client);
    5.51 -	SetMenuTitle(menu, title);
    5.52 -	SetMenuExitBackButton(menu, true);
    5.53 -	
    5.54 -	AddMenuItem(menu, "0", "0");
    5.55 -	AddMenuItem(menu, "1", "1");
    5.56 -	AddMenuItem(menu, "5", "5");
    5.57 -	AddMenuItem(menu, "10", "10");
    5.58 -	AddMenuItem(menu, "20", "20");
    5.59 -	AddMenuItem(menu, "50", "50");
    5.60 -	AddMenuItem(menu, "99", "99");
    5.61 -	
    5.62 -	DisplayMenu(menu, client, MENU_TIME_FOREVER);
    5.63 -}
    5.64 -
    5.65 -DisplaySlapTargetMenu(client)
    5.66 -{
    5.67 -	new Handle:menu = CreateMenu(MenuHandler_Slap);
    5.68 -	
    5.69 -	decl String:title[100];
    5.70 -	Format(title, sizeof(title), "%T:", "Slap player", client);
    5.71 -	SetMenuTitle(menu, title);
    5.72 -	SetMenuExitBackButton(menu, true);
    5.73 -	
    5.74 -	AddTargetsToMenu(menu, client, true, true);
    5.75 -	
    5.76 -	DisplayMenu(menu, client, MENU_TIME_FOREVER);
    5.77 -}
    5.78 -
    5.79 -public AdminMenu_Slap(Handle:topmenu, 
    5.80 -					  TopMenuAction:action,
    5.81 -					  TopMenuObject:object_id,
    5.82 -					  param,
    5.83 -					  String:buffer[],
    5.84 -					  maxlength)
    5.85 -{
    5.86 -	if (action == TopMenuAction_DisplayOption)
    5.87 -	{
    5.88 -		Format(buffer, maxlength, "%T", "Slap player", param);
    5.89 -	}
    5.90 -	else if (action == TopMenuAction_SelectOption)
    5.91 -	{
    5.92 -		DisplaySlapDamageMenu(param);
    5.93 -	}
    5.94 -}
    5.95 -
    5.96 -public MenuHandler_SlapDamage(Handle:menu, MenuAction:action, param1, param2)
    5.97 -{
    5.98 -	if (action == MenuAction_End)
    5.99 -	{
   5.100 -		CloseHandle(menu);
   5.101 -	}
   5.102 -	else if (action == MenuAction_Cancel)
   5.103 -	{
   5.104 -		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   5.105 -		{
   5.106 -			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   5.107 -		}
   5.108 -	}
   5.109 -	else if (action == MenuAction_Select)
   5.110 -	{
   5.111 -		decl String:info[32];
   5.112 -		
   5.113 -		GetMenuItem(menu, param2, info, sizeof(info));
   5.114 -		g_SlapDamage[param1] = StringToInt(info);
   5.115 -		
   5.116 -		DisplaySlapTargetMenu(param1);
   5.117 -	}
   5.118 -}
   5.119 -
   5.120 -public MenuHandler_Slap(Handle:menu, MenuAction:action, param1, param2)
   5.121 -{
   5.122 -	if (action == MenuAction_End)
   5.123 -	{
   5.124 -		CloseHandle(menu);
   5.125 -	}
   5.126 -	else if (action == MenuAction_Cancel)
   5.127 -	{
   5.128 -		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   5.129 -		{
   5.130 -			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   5.131 -		}
   5.132 -	}
   5.133 -	else if (action == MenuAction_Select)
   5.134 -	{
   5.135 -		decl String:info[32];
   5.136 -		new userid, target;
   5.137 -		
   5.138 -		GetMenuItem(menu, param2, info, sizeof(info));
   5.139 -		userid = StringToInt(info);
   5.140 -
   5.141 -		if ((target = GetClientOfUserId(userid)) == 0)
   5.142 -		{
   5.143 -			PrintToChat(param1, "[SM] %t", "Player no longer available");
   5.144 -		}
   5.145 -		else if (!CanUserTarget(param1, target))
   5.146 -		{
   5.147 -			PrintToChat(param1, "[SM] %t", "Unable to target");
   5.148 -		}
   5.149 -		else if (!IsPlayerAlive(target))
   5.150 -		{
   5.151 -			ReplyToCommand(param1, "[SM] %t", "Player has since died");
   5.152 -		}	
   5.153 -		else
   5.154 -		{
   5.155 -			decl String:name[32];
   5.156 -			GetClientName(target, name, sizeof(name));
   5.157 -			PerformSlap(param1, target, g_SlapDamage[param1]);
   5.158 -			ShowActivity2(param1, "[SM] ", "%t", "Slapped target", "_s", name);
   5.159 -		}
   5.160 -		
   5.161 -		DisplaySlapTargetMenu(param1);
   5.162 -	}
   5.163 -}
   5.164 -
   5.165 -public Action:Command_Slap(client, args)
   5.166 -{
   5.167 -	if (args < 1)
   5.168 -	{
   5.169 -		ReplyToCommand(client, "[SM] Usage: sm_slap <#userid|name> [damage]");
   5.170 -		return Plugin_Handled;
   5.171 -	}
   5.172 -
   5.173 -	decl String:arg[65];
   5.174 -	GetCmdArg(1, arg, sizeof(arg));
   5.175 -
   5.176 -	new damage = 0;
   5.177 -	if (args > 1)
   5.178 -	{
   5.179 -		decl String:arg2[20];
   5.180 -		GetCmdArg(2, arg2, sizeof(arg2));
   5.181 -		if (StringToIntEx(arg2, damage) == 0)
   5.182 -		{
   5.183 -			ReplyToCommand(client, "[SM] %t", "Invalid Amount");
   5.184 -			return Plugin_Handled;
   5.185 -		}
   5.186 -	}
   5.187 -	
   5.188 -	decl String:target_name[MAX_TARGET_LENGTH];
   5.189 -	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   5.190 -	
   5.191 -	if ((target_count = ProcessTargetString(
   5.192 -			arg,
   5.193 -			client,
   5.194 -			target_list,
   5.195 -			MAXPLAYERS,
   5.196 -			COMMAND_FILTER_ALIVE,
   5.197 -			target_name,
   5.198 -			sizeof(target_name),
   5.199 -			tn_is_ml)) <= 0)
   5.200 -	{
   5.201 -		ReplyToTargetError(client, target_count);
   5.202 -		return Plugin_Handled;
   5.203 -	}
   5.204 -	
   5.205 -	for (new i = 0; i < target_count; i++)
   5.206 -	{
   5.207 -		PerformSlap(client, target_list[i], damage);
   5.208 -	}
   5.209 -
   5.210 -	if (tn_is_ml)
   5.211 -	{
   5.212 -		ShowActivity2(client, "[SM] ", "%t", "Slapped target", target_name);
   5.213 -	}
   5.214 -	else
   5.215 -	{
   5.216 -		ShowActivity2(client, "[SM] ", "%t", "Slapped target", "_s", target_name);
   5.217 -	}
   5.218 -
   5.219 -	return Plugin_Handled;
   5.220 -}
     6.1 --- a/plugins/slapslay/slay.sp	Wed Dec 19 01:20:56 2007 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,159 +0,0 @@
     6.4 -/**
     6.5 - * vim: set ts=4 :
     6.6 - * =============================================================================
     6.7 - * SourceMod Basefuncommands Plugin
     6.8 - * Provides slay functionality
     6.9 - *
    6.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
    6.11 - * =============================================================================
    6.12 - *
    6.13 - * This program is free software; you can redistribute it and/or modify it under
    6.14 - * the terms of the GNU General Public License, version 3.0, as published by the
    6.15 - * Free Software Foundation.
    6.16 - * 
    6.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
    6.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    6.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    6.20 - * details.
    6.21 - *
    6.22 - * You should have received a copy of the GNU General Public License along with
    6.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
    6.24 - *
    6.25 - * As a special exception, AlliedModders LLC gives you permission to link the
    6.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
    6.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    6.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
    6.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
    6.30 - * this exception to all derivative works.  AlliedModders LLC defines further
    6.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    6.32 - * or <http://www.sourcemod.net/license.php>.
    6.33 - *
    6.34 - * Version: $Id$
    6.35 - */
    6.36 -
    6.37 -PerformSlay(client, target)
    6.38 -{
    6.39 -	LogAction(client, target, "\"%L\" slayed \"%L\"", client, target);
    6.40 -	ForcePlayerSuicide(target);
    6.41 -}
    6.42 -
    6.43 -DisplaySlayMenu(client)
    6.44 -{
    6.45 -	new Handle:menu = CreateMenu(MenuHandler_Slay);
    6.46 -	
    6.47 -	decl String:title[100];
    6.48 -	Format(title, sizeof(title), "%T:", "Slay player", client);
    6.49 -	SetMenuTitle(menu, title);
    6.50 -	SetMenuExitBackButton(menu, true);
    6.51 -	
    6.52 -	AddTargetsToMenu(menu, client, true, true);
    6.53 -	
    6.54 -	DisplayMenu(menu, client, MENU_TIME_FOREVER);
    6.55 -}
    6.56 -
    6.57 -public AdminMenu_Slay(Handle:topmenu, 
    6.58 -					  TopMenuAction:action,
    6.59 -					  TopMenuObject:object_id,
    6.60 -					  param,
    6.61 -					  String:buffer[],
    6.62 -					  maxlength)
    6.63 -{
    6.64 -	if (action == TopMenuAction_DisplayOption)
    6.65 -	{
    6.66 -		Format(buffer, maxlength, "%T", "Slay player", param);
    6.67 -	}
    6.68 -	else if (action == TopMenuAction_SelectOption)
    6.69 -	{
    6.70 -		DisplaySlayMenu(param);
    6.71 -	}
    6.72 -}
    6.73 -
    6.74 -public MenuHandler_Slay(Handle:menu, MenuAction:action, param1, param2)
    6.75 -{
    6.76 -	if (action == MenuAction_End)
    6.77 -	{
    6.78 -		CloseHandle(menu);
    6.79 -	}
    6.80 -	else if (action == MenuAction_Cancel)
    6.81 -	{
    6.82 -		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
    6.83 -		{
    6.84 -			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
    6.85 -		}
    6.86 -	}
    6.87 -	else if (action == MenuAction_Select)
    6.88 -	{
    6.89 -		decl String:info[32];
    6.90 -		new userid, target;
    6.91 -		
    6.92 -		GetMenuItem(menu, param2, info, sizeof(info));
    6.93 -		userid = StringToInt(info);
    6.94 -
    6.95 -		if ((target = GetClientOfUserId(userid)) == 0)
    6.96 -		{
    6.97 -			PrintToChat(param1, "[SM] %t", "Player no longer available");
    6.98 -		}
    6.99 -		else if (!CanUserTarget(param1, target))
   6.100 -		{
   6.101 -			PrintToChat(param1, "[SM] %t", "Unable to target");
   6.102 -		}
   6.103 -		else if (!IsPlayerAlive(target))
   6.104 -		{
   6.105 -			ReplyToCommand(param1, "[SM] %t", "Player has since died");
   6.106 -		}
   6.107 -		else
   6.108 -		{
   6.109 -			decl String:name[32];
   6.110 -			GetClientName(target, name, sizeof(name));
   6.111 -			PerformSlay(param1, target);
   6.112 -			ShowActivity2(param1, "[SM] ", "%t", "Slayed target", "_s", name);
   6.113 -		}
   6.114 -		
   6.115 -		DisplaySlayMenu(param1);
   6.116 -	}
   6.117 -}
   6.118 -
   6.119 -public Action:Command_Slay(client, args)
   6.120 -{
   6.121 -	if (args < 1)
   6.122 -	{
   6.123 -		ReplyToCommand(client, "[SM] Usage: sm_slay <#userid|name>");
   6.124 -		return Plugin_Handled;
   6.125 -	}
   6.126 -
   6.127 -	decl String:arg[65];
   6.128 -	GetCmdArg(1, arg, sizeof(arg));
   6.129 -
   6.130 -	decl String:target_name[MAX_TARGET_LENGTH];
   6.131 -	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   6.132 -	
   6.133 -	if ((target_count = ProcessTargetString(
   6.134 -			arg,
   6.135 -			client,
   6.136 -			target_list,
   6.137 -			MAXPLAYERS,
   6.138 -			COMMAND_FILTER_ALIVE,
   6.139 -			target_name,
   6.140 -			sizeof(target_name),
   6.141 -			tn_is_ml)) <= 0)
   6.142 -	{
   6.143 -		ReplyToTargetError(client, target_count);
   6.144 -		return Plugin_Handled;
   6.145 -	}
   6.146 -
   6.147 -	for (new i = 0; i < target_count; i++)
   6.148 -	{
   6.149 -		PerformSlay(client, target_list[i]);
   6.150 -	}
   6.151 -	
   6.152 -	if (tn_is_ml)
   6.153 -	{
   6.154 -		ShowActivity2(client, "[SM] ", "%t", "Slayed target", target_name);
   6.155 -	}
   6.156 -	else
   6.157 -	{
   6.158 -		ShowActivity2(client, "[SM] ", "%t", "Slayed target", "_s", target_name);
   6.159 -	}
   6.160 -
   6.161 -	return Plugin_Handled;
   6.162 -}