|
ds@1952
|
1 |
/** |
|
ds@1952
|
2 |
* vim: set ts=4 : |
|
ds@1952
|
3 |
* ============================================================================= |
|
ds@1952
|
4 |
* SourceMod SlapSlay Commands Plugin |
|
ds@1952
|
5 |
* Implements slap and slay commands |
|
ds@1952
|
6 |
* |
|
ds@1952
|
7 |
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved. |
|
ds@1952
|
8 |
* ============================================================================= |
|
ds@1952
|
9 |
* |
|
ds@1952
|
10 |
* This program is free software; you can redistribute it and/or modify it under |
|
ds@1952
|
11 |
* the terms of the GNU General Public License, version 3.0, as published by the |
|
ds@1952
|
12 |
* Free Software Foundation. |
|
ds@1952
|
13 |
* |
|
ds@1952
|
14 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
ds@1952
|
15 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
ds@1952
|
16 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
ds@1952
|
17 |
* details. |
|
ds@1952
|
18 |
* |
|
ds@1952
|
19 |
* You should have received a copy of the GNU General Public License along with |
|
ds@1952
|
20 |
* this program. If not, see <http://www.gnu.org/licenses/>. |
|
ds@1952
|
21 |
* |
|
ds@1952
|
22 |
* As a special exception, AlliedModders LLC gives you permission to link the |
|
ds@1952
|
23 |
* code of this program (as well as its derivative works) to "Half-Life 2," the |
|
ds@1952
|
24 |
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software |
|
ds@1952
|
25 |
* by the Valve Corporation. You must obey the GNU General Public License in |
|
ds@1952
|
26 |
* all respects for all other code used. Additionally, AlliedModders LLC grants |
|
ds@1952
|
27 |
* this exception to all derivative works. AlliedModders LLC defines further |
|
ds@1952
|
28 |
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), |
|
ds@1952
|
29 |
* or <http://www.sourcemod.net/license.php>. |
|
ds@1952
|
30 |
* |
|
ds@1952
|
31 |
* Version: $Id$ |
|
ds@1952
|
32 |
*/ |
|
ds@1952
|
33 |
|
|
ds@1952
|
34 |
#pragma semicolon 1 |
|
ds@1952
|
35 |
|
|
ds@1952
|
36 |
#include <sourcemod> |
|
ds@1952
|
37 |
#include <sdktools> |
|
ds@1952
|
38 |
#undef REQUIRE_PLUGIN |
|
ds@1952
|
39 |
#include <adminmenu> |
|
ds@1952
|
40 |
|
|
ds@1952
|
41 |
public Plugin:myinfo = |
|
ds@1952
|
42 |
{ |
|
ds@1952
|
43 |
name = "SlapSlay Commands", |
|
ds@1952
|
44 |
author = "AlliedModders LLC", |
|
ds@1952
|
45 |
description = "Slap and Slay Commands", |
|
ds@1952
|
46 |
version = SOURCEMOD_VERSION, |
|
ds@1952
|
47 |
url = "http://www.sourcemod.net/" |
|
ds@1952
|
48 |
}; |
|
ds@1952
|
49 |
|
|
ds@1952
|
50 |
new Handle:hTopMenu = INVALID_HANDLE; |
|
ds@1952
|
51 |
|
|
ds@1952
|
52 |
#include "playercommands/slay.sp" |
|
ds@1952
|
53 |
#include "playercommands/slap.sp" |
|
ds@1952
|
54 |
|
|
ds@1952
|
55 |
public OnPluginStart() |
|
ds@1952
|
56 |
{ |
|
ds@1952
|
57 |
LoadTranslations("common.phrases"); |
|
ds@1952
|
58 |
LoadTranslations("slapslay.phrases"); |
|
ds@1952
|
59 |
|
|
ds@1952
|
60 |
RegAdminCmd("sm_slap", Command_Slap, ADMFLAG_SLAY, "sm_slap <#userid|name> [damage]"); |
|
ds@1952
|
61 |
RegAdminCmd("sm_slay", Command_Slay, ADMFLAG_SLAY, "sm_slay <#userid|name>"); |
|
ds@1952
|
62 |
|
|
ds@1952
|
63 |
/* Account for late loading */ |
|
ds@1952
|
64 |
new Handle:topmenu; |
|
ds@1952
|
65 |
if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE)) |
|
ds@1952
|
66 |
{ |
|
ds@1952
|
67 |
OnAdminMenuReady(topmenu); |
|
ds@1952
|
68 |
} |
|
ds@1952
|
69 |
} |
|
ds@1952
|
70 |
|
|
ds@1952
|
71 |
public OnAdminMenuReady(Handle:topmenu) |
|
ds@1952
|
72 |
{ |
|
ds@1952
|
73 |
/* Block us from being called twice */ |
|
ds@1952
|
74 |
if (topmenu == hTopMenu) |
|
ds@1952
|
75 |
{ |
|
ds@1952
|
76 |
return; |
|
ds@1952
|
77 |
} |
|
ds@1952
|
78 |
|
|
ds@1952
|
79 |
/* Save the Handle */ |
|
ds@1952
|
80 |
hTopMenu = topmenu; |
|
ds@1952
|
81 |
|
|
ds@1952
|
82 |
/* Find the "Player Commands" category */ |
|
ds@1952
|
83 |
new TopMenuObject:player_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_PLAYERCOMMANDS); |
|
ds@1952
|
84 |
|
|
ds@1952
|
85 |
if (player_commands != INVALID_TOPMENUOBJECT) |
|
ds@1952
|
86 |
{ |
|
ds@1952
|
87 |
AddToTopMenu(hTopMenu, |
|
ds@1952
|
88 |
"sm_slay", |
|
ds@1952
|
89 |
TopMenuObject_Item, |
|
ds@1952
|
90 |
AdminMenu_Slay, |
|
ds@1952
|
91 |
player_commands, |
|
ds@1952
|
92 |
"sm_slay", |
|
ds@1952
|
93 |
ADMFLAG_SLAY); |
|
ds@1952
|
94 |
|
|
ds@1952
|
95 |
AddToTopMenu(hTopMenu, |
|
ds@1952
|
96 |
"sm_slap", |
|
ds@1952
|
97 |
TopMenuObject_Item, |
|
ds@1952
|
98 |
AdminMenu_Slap, |
|
ds@1952
|
99 |
player_commands, |
|
ds@1952
|
100 |
"sm_slap", |
|
ds@1952
|
101 |
ADMFLAG_SLAY); |
|
ds@1952
|
102 |
} |
|
ds@1952
|
103 |
} |