3 * =============================================================================
4 * SourceMod Basic Fun Commands Plugin
5 * Implements basic punishment commands.
7 * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
8 * =============================================================================
10 * This program is free software; you can redistribute it and/or modify it under
11 * the terms of the GNU General Public License, version 3.0, as published by the
12 * Free Software Foundation.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 * You should have received a copy of the GNU General Public License along with
20 * this program. If not, see <http://www.gnu.org/licenses/>.
22 * As a special exception, AlliedModders LLC gives you permission to link the
23 * code of this program (as well as its derivative works) to "Half-Life 2," the
24 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
25 * by the Valve Corporation. You must obey the GNU General Public License in
26 * all respects for all other code used. Additionally, AlliedModders LLC grants
27 * this exception to all derivative works. AlliedModders LLC defines further
28 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
29 * or <http://www.sourcemod.net/license.php>.
41 public Plugin:myinfo =
43 name = "Basic Fun Commands",
44 author = "AlliedModders LLC",
45 description = "Basic Fun Commands",
46 version = SOURCEMOD_VERSION,
47 url = "http://www.sourcemod.net/"
50 new Handle:hTopMenu = INVALID_HANDLE;
52 new g_SlapDamage[MAXPLAYERS+1];
54 #include "basefuncommands/slay.sp"
55 #include "basefuncommands/burn.sp"
56 #include "basefuncommands/slap.sp"
58 public OnPluginStart()
60 LoadTranslations("common.phrases");
61 LoadTranslations("basefuncommands.phrases");
63 RegAdminCmd("sm_burn", Command_Burn, ADMFLAG_SLAY, "sm_burn <#userid|name> [time]");
64 RegAdminCmd("sm_slap", Command_Slap, ADMFLAG_SLAY, "sm_slap <#userid|name> [damage]");
65 RegAdminCmd("sm_slay", Command_Slay, ADMFLAG_SLAY, "sm_slay <#userid|name>");
66 RegAdminCmd("sm_play", Command_Play, ADMFLAG_GENERIC, "sm_play <#userid|name> <filename>");
68 /* Account for late loading */
70 if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
72 OnAdminMenuReady(topmenu);
76 public OnAdminMenuReady(Handle:topmenu)
78 /* Block us from being called twice */
79 if (topmenu == hTopMenu)
87 /* Find the "Player Commands" category */
88 new TopMenuObject:player_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_PLAYERCOMMANDS);
90 if (player_commands != INVALID_TOPMENUOBJECT)
92 AddToTopMenu(hTopMenu,
100 AddToTopMenu(hTopMenu,
108 AddToTopMenu(hTopMenu,
118 public Action:Command_Play(client, args)
122 ReplyToCommand(client, "[SM] Usage: sm_play <#userid|name> <filename>");
125 new String:Arguments[PLATFORM_MAX_PATH + 65];
126 GetCmdArgString(Arguments, sizeof(Arguments));
129 new len = BreakString(Arguments, Arg, sizeof(Arg));
131 /* Make sure it does not go out of bound by doing "sm_play user "*/
134 ReplyToCommand(client, "[SM] Usage: sm_play <#userid|name> <filename>");
135 return Plugin_Handled;
138 /* Incase they put quotes and white spaces after the quotes */
139 if (Arguments[len] == '"')
142 new FileLen = TrimString(Arguments[len]) + len;
144 if (Arguments[FileLen - 1] == '"')
146 Arguments[FileLen - 1] = '\0';
150 decl String:target_name[MAX_TARGET_LENGTH];
151 decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
153 if ((target_count = ProcessTargetString(
158 COMMAND_FILTER_NO_BOTS,
163 ReplyToTargetError(client, target_count);
164 return Plugin_Handled;
167 for (new i = 0; i < target_count; i++)
169 ClientCommand(target_list[i], "playgamesound \"%s\"", Arguments[len]);
170 LogAction(client, target_list[i], "\"%L\" played sound on \"%L\" (file \"%s\")", client, target_list[i], Arguments[len]);
175 ShowActivity2(client, "[SM] ", "%t", "Played sound to target", target_name);
179 ShowActivity2(client, "[SM] ", "%t", "Played sound to target", "_s", target_name);
182 return Plugin_Handled;