1.1 --- a/plugins/playercommands/slay.sp Fri Jul 11 06:51:21 2008 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,159 +0,0 @@
1.4 -/**
1.5 - * vim: set ts=4 :
1.6 - * =============================================================================
1.7 - * SourceMod Basefuncommands Plugin
1.8 - * Provides slay functionality
1.9 - *
1.10 - * SourceMod (C)2004-2008 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 -PerformSlay(client, target)
1.38 -{
1.39 - LogAction(client, target, "\"%L\" slayed \"%L\"", client, target);
1.40 - ForcePlayerSuicide(target);
1.41 -}
1.42 -
1.43 -DisplaySlayMenu(client)
1.44 -{
1.45 - new Handle:menu = CreateMenu(MenuHandler_Slay);
1.46 -
1.47 - decl String:title[100];
1.48 - Format(title, sizeof(title), "%T:", "Slay player", client);
1.49 - SetMenuTitle(menu, title);
1.50 - SetMenuExitBackButton(menu, true);
1.51 -
1.52 - AddTargetsToMenu(menu, client, true, true);
1.53 -
1.54 - DisplayMenu(menu, client, MENU_TIME_FOREVER);
1.55 -}
1.56 -
1.57 -public AdminMenu_Slay(Handle:topmenu,
1.58 - TopMenuAction:action,
1.59 - TopMenuObject:object_id,
1.60 - param,
1.61 - String:buffer[],
1.62 - maxlength)
1.63 -{
1.64 - if (action == TopMenuAction_DisplayOption)
1.65 - {
1.66 - Format(buffer, maxlength, "%T", "Slay player", param);
1.67 - }
1.68 - else if (action == TopMenuAction_SelectOption)
1.69 - {
1.70 - DisplaySlayMenu(param);
1.71 - }
1.72 -}
1.73 -
1.74 -public MenuHandler_Slay(Handle:menu, MenuAction:action, param1, param2)
1.75 -{
1.76 - if (action == MenuAction_End)
1.77 - {
1.78 - CloseHandle(menu);
1.79 - }
1.80 - else if (action == MenuAction_Cancel)
1.81 - {
1.82 - if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
1.83 - {
1.84 - DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
1.85 - }
1.86 - }
1.87 - else if (action == MenuAction_Select)
1.88 - {
1.89 - decl String:info[32];
1.90 - new userid, target;
1.91 -
1.92 - GetMenuItem(menu, param2, info, sizeof(info));
1.93 - userid = StringToInt(info);
1.94 -
1.95 - if ((target = GetClientOfUserId(userid)) == 0)
1.96 - {
1.97 - PrintToChat(param1, "[SM] %t", "Player no longer available");
1.98 - }
1.99 - else if (!CanUserTarget(param1, target))
1.100 - {
1.101 - PrintToChat(param1, "[SM] %t", "Unable to target");
1.102 - }
1.103 - else if (!IsPlayerAlive(target))
1.104 - {
1.105 - ReplyToCommand(param1, "[SM] %t", "Player has since died");
1.106 - }
1.107 - else
1.108 - {
1.109 - decl String:name[32];
1.110 - GetClientName(target, name, sizeof(name));
1.111 - PerformSlay(param1, target);
1.112 - ShowActivity2(param1, "[SM] ", "%t", "Slayed target", "_s", name);
1.113 - }
1.114 -
1.115 - DisplaySlayMenu(param1);
1.116 - }
1.117 -}
1.118 -
1.119 -public Action:Command_Slay(client, args)
1.120 -{
1.121 - if (args < 1)
1.122 - {
1.123 - ReplyToCommand(client, "[SM] Usage: sm_slay <#userid|name>");
1.124 - return Plugin_Handled;
1.125 - }
1.126 -
1.127 - decl String:arg[65];
1.128 - GetCmdArg(1, arg, sizeof(arg));
1.129 -
1.130 - decl String:target_name[MAX_TARGET_LENGTH];
1.131 - decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
1.132 -
1.133 - if ((target_count = ProcessTargetString(
1.134 - arg,
1.135 - client,
1.136 - target_list,
1.137 - MAXPLAYERS,
1.138 - COMMAND_FILTER_ALIVE,
1.139 - target_name,
1.140 - sizeof(target_name),
1.141 - tn_is_ml)) <= 0)
1.142 - {
1.143 - ReplyToTargetError(client, target_count);
1.144 - return Plugin_Handled;
1.145 - }
1.146 -
1.147 - for (new i = 0; i < target_count; i++)
1.148 - {
1.149 - PerformSlay(client, target_list[i]);
1.150 - }
1.151 -
1.152 - if (tn_is_ml)
1.153 - {
1.154 - ShowActivity2(client, "[SM] ", "%t", "Slayed target", target_name);
1.155 - }
1.156 - else
1.157 - {
1.158 - ShowActivity2(client, "[SM] ", "%t", "Slayed target", "_s", target_name);
1.159 - }
1.160 -
1.161 - return Plugin_Handled;
1.162 -}