ferret99gt@1194: /**
ds@1330: * vim: set ts=4 :
ds@1330: * =============================================================================
ds@1330: * SourceMod Basic Fun Commands Plugin
ferret99gt@1194: * Implements basic punishment commands.
ds@1330: *
ds@1330: * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
ds@1330: * =============================================================================
ferret99gt@1194: *
ds@1330: * This program is free software; you can redistribute it and/or modify it under
ds@1330: * the terms of the GNU General Public License, version 3.0, as published by the
ds@1330: * Free Software Foundation.
ds@1330: *
ds@1330: * This program is distributed in the hope that it will be useful, but WITHOUT
ds@1330: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
ds@1330: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
ds@1330: * details.
ferret99gt@1194: *
ds@1330: * You should have received a copy of the GNU General Public License along with
ds@1330: * this program. If not, see .
teame06@1212: *
ds@1330: * As a special exception, AlliedModders LLC gives you permission to link the
ds@1330: * code of this program (as well as its derivative works) to "Half-Life 2," the
ds@1330: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
ds@1330: * by the Valve Corporation. You must obey the GNU General Public License in
ds@1330: * all respects for all other code used. Additionally, AlliedModders LLC grants
ds@1330: * this exception to all derivative works. AlliedModders LLC defines further
ds@1330: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
ds@1330: * or .
ferret99gt@1194: *
ferret99gt@1194: * Version: $Id$
ferret99gt@1194: */
ferret99gt@1194:
ferret99gt@1194: #pragma semicolon 1
ferret99gt@1194:
ferret99gt@1194: #include
ferret99gt@1194: #include
pred@1536: #undef REQUIRE_PLUGIN
pred@1536: #include
ferret99gt@1194:
teame06@1212: public Plugin:myinfo =
ferret99gt@1194: {
ferret99gt@1194: name = "Basic Fun Commands",
ferret99gt@1194: author = "AlliedModders LLC",
ferret99gt@1194: description = "Basic Fun Commands",
ferret99gt@1194: version = SOURCEMOD_VERSION,
ferret99gt@1194: url = "http://www.sourcemod.net/"
ferret99gt@1194: };
ferret99gt@1194:
pred@1536: new Handle:hTopMenu = INVALID_HANDLE;
pred@1536:
pred@1536: new g_SlapDamage[MAXPLAYERS+1];
pred@1536:
pred@1536: #include "basefuncommands/slay.sp"
pred@1536: #include "basefuncommands/burn.sp"
pred@1536: #include "basefuncommands/slap.sp"
pred@1536:
ferret99gt@1194: public OnPluginStart()
ferret99gt@1194: {
ferret99gt@1194: LoadTranslations("common.phrases");
ferret99gt@1194:
ferret99gt@1194: RegAdminCmd("sm_burn", Command_Burn, ADMFLAG_SLAY, "sm_burn <#userid|name> [time]");
ferret99gt@1194: RegAdminCmd("sm_slap", Command_Slap, ADMFLAG_SLAY, "sm_slap <#userid|name> [damage]");
ferret99gt@1194: RegAdminCmd("sm_slay", Command_Slay, ADMFLAG_SLAY, "sm_slay <#userid|name>");
teame06@1214: RegAdminCmd("sm_play", Command_Play, ADMFLAG_GENERIC, "sm_play <#userid|name> ");
pred@1536:
pred@1536: /* Account for late loading */
pred@1536: new Handle:topmenu;
pred@1536: if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
pred@1536: {
pred@1536: OnAdminMenuReady(topmenu);
pred@1536: }
pred@1536: }
pred@1536:
pred@1536: public OnAdminMenuReady(Handle:topmenu)
pred@1536: {
pred@1536: /* Block us from being called twice */
pred@1536: if (topmenu == hTopMenu)
pred@1536: {
pred@1536: return;
pred@1536: }
pred@1536:
pred@1536: /* Save the Handle */
pred@1536: hTopMenu = topmenu;
pred@1536:
pred@1536: /* Find the "Player Commands" category */
pred@1536: new TopMenuObject:player_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_PLAYERCOMMANDS);
pred@1536:
pred@1536: if (player_commands != INVALID_TOPMENUOBJECT)
pred@1536: {
pred@1536: AddToTopMenu(hTopMenu,
dvander@1600: "sm_slay",
pred@1536: TopMenuObject_Item,
pred@1536: AdminMenu_Slay,
pred@1536: player_commands,
pred@1536: "sm_slay",
pred@1536: ADMFLAG_SLAY);
pred@1536:
pred@1536: AddToTopMenu(hTopMenu,
dvander@1600: "sm_burn",
pred@1536: TopMenuObject_Item,
pred@1536: AdminMenu_Burn,
pred@1536: player_commands,
pred@1536: "sm_burn",
pred@1536: ADMFLAG_SLAY);
pred@1536:
pred@1536: AddToTopMenu(hTopMenu,
dvander@1600: "sm_slap",
pred@1536: TopMenuObject_Item,
pred@1536: AdminMenu_Slap,
pred@1536: player_commands,
pred@1536: "sm_slap",
pred@1536: ADMFLAG_SLAY);
pred@1536: }
teame06@1212: }
teame06@1212:
teame06@1212: public Action:Command_Play(client, args)
teame06@1212: {
teame06@1241: if (args < 2)
teame06@1212: {
teame06@1214: ReplyToCommand(client, "[SM] Usage: sm_play <#userid|name> ");
teame06@1212: }
teame06@1212:
teame06@1214: new String:Arguments[PLATFORM_MAX_PATH + 65];
teame06@1214: GetCmdArgString(Arguments, sizeof(Arguments));
teame06@1214:
teame06@1214: decl String:Arg[65];
teame06@1214: new len = BreakString(Arguments, Arg, sizeof(Arg));
teame06@1212:
teame06@1212: new target = FindTarget(client, Arg);
teame06@1212: if (target == -1)
teame06@1212: {
teame06@1212: return Plugin_Handled;
teame06@1212: }
teame06@1212:
teame06@1214: /* Make sure it does not go out of bound by doing "sm_play user "*/
teame06@1241: if (len == -1)
teame06@1214: {
teame06@1214: ReplyToCommand(client, "[SM] Usage: sm_play <#userid|name> ");
teame06@1214: return Plugin_Handled;
teame06@1214: }
teame06@1212:
teame06@1214: /* Incase they put quotes and white spaces after the quotes */
teame06@1241: if (Arguments[len] == '"')
teame06@1214: {
teame06@1214: len++;
teame06@1214: new FileLen = TrimString(Arguments[len]) + len;
teame06@1214:
teame06@1241: if (Arguments[FileLen - 1] == '"')
teame06@1214: {
teame06@1214: Arguments[FileLen - 1] = '\0';
teame06@1214: }
teame06@1214: }
teame06@1214:
teame06@1214: GetClientName(target, Arg, sizeof(Arg));
teame06@1212: ShowActivity(client, "%t", "Played Sound", Arg);
dvander@1378: LogAction(client, target, "\"%L\" played sound on \"%L\" (file \"%s\")", client, target, Arguments[len]);
teame06@1212:
teame06@1214: ClientCommand(target, "playgamesound \"%s\"", Arguments[len]);
teame06@1212:
teame06@1212: return Plugin_Handled;
ferret99gt@1194: }
ferret99gt@1194: