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>.
39 public Plugin:myinfo =
41 name = "Basic Fun Commands",
42 author = "AlliedModders LLC",
43 description = "Basic Fun Commands",
44 version = SOURCEMOD_VERSION,
45 url = "http://www.sourcemod.net/"
48 public OnPluginStart()
50 LoadTranslations("common.phrases");
52 RegAdminCmd("sm_burn", Command_Burn, ADMFLAG_SLAY, "sm_burn <#userid|name> [time]");
53 RegAdminCmd("sm_slap", Command_Slap, ADMFLAG_SLAY, "sm_slap <#userid|name> [damage]");
54 RegAdminCmd("sm_slay", Command_Slay, ADMFLAG_SLAY, "sm_slay <#userid|name>");
55 RegAdminCmd("sm_play", Command_Play, ADMFLAG_GENERIC, "sm_play <#userid|name> <filename>");
58 public Action:Command_Play(client, args)
62 ReplyToCommand(client, "[SM] Usage: sm_play <#userid|name> <filename>");
65 new String:Arguments[PLATFORM_MAX_PATH + 65];
66 GetCmdArgString(Arguments, sizeof(Arguments));
69 new len = BreakString(Arguments, Arg, sizeof(Arg));
71 new target = FindTarget(client, Arg);
74 return Plugin_Handled;
77 /* Make sure it does not go out of bound by doing "sm_play user "*/
80 ReplyToCommand(client, "[SM] Usage: sm_play <#userid|name> <filename>");
81 return Plugin_Handled;
84 /* Incase they put quotes and white spaces after the quotes */
85 if (Arguments[len] == '"')
88 new FileLen = TrimString(Arguments[len]) + len;
90 if (Arguments[FileLen - 1] == '"')
92 Arguments[FileLen - 1] = '\0';
96 GetClientName(target, Arg, sizeof(Arg));
97 ShowActivity(client, "%t", "Played Sound", Arg);
98 LogAction(client, target, "\"%L\" played sound on \"%L\" (file \"%s\")", client, target, Arguments[len]);
100 ClientCommand(target, "playgamesound \"%s\"", Arguments[len]);
102 return Plugin_Handled;
105 public Action:Command_Burn(client, args)
109 ReplyToCommand(client, "[SM] Usage: sm_burn <#userid|name> [time]");
110 return Plugin_Handled;
114 GetCmdArg(1, arg, sizeof(arg));
116 new target = FindTarget(client, arg);
119 return Plugin_Handled;
122 GetClientName(target, arg, sizeof(arg));
124 if (!IsPlayerAlive(target))
126 ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", arg);
127 return Plugin_Handled;
130 new Float:seconds = 20.0;
133 decl String:time[20];
134 GetCmdArg(2, time, sizeof(time));
135 if (StringToFloatEx(time, seconds) == 0)
137 ReplyToCommand(client, "[SM] %t", "Invalid Amount");
138 return Plugin_Handled;
142 ShowActivity(client, "%t", "Ignited player", arg);
143 LogAction(client, target, "\"%L\" ignited \"%L\" (seconds \"%f\")", client, target, seconds);
144 IgniteEntity(target, seconds);
146 return Plugin_Handled;
149 public Action:Command_Slap(client, args)
153 ReplyToCommand(client, "[SM] Usage: sm_slap <#userid|name> [damage]");
154 return Plugin_Handled;
158 GetCmdArg(1, arg, sizeof(arg));
160 new target = FindTarget(client, arg);
163 return Plugin_Handled;
166 GetClientName(target, arg, sizeof(arg));
168 if (!IsPlayerAlive(target))
170 ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", arg);
171 return Plugin_Handled;
177 decl String:arg2[20];
178 GetCmdArg(2, arg2, sizeof(arg2));
179 if (StringToIntEx(arg2, damage) == 0)
181 ReplyToCommand(client, "[SM] %t", "Invalid Amount");
182 return Plugin_Handled;
186 ShowActivity(client, "%t", "Slapped player", arg);
187 LogAction(client, target, "\"%L\" slapped \"%L\" (damage \"%d\")", client, target, damage);
188 SlapPlayer(target, damage, true);
190 return Plugin_Handled;
193 public Action:Command_Slay(client, args)
197 ReplyToCommand(client, "[SM] Usage: sm_slay <#userid|name>");
198 return Plugin_Handled;
202 GetCmdArg(1, arg, sizeof(arg));
204 new target = FindTarget(client, arg);
207 return Plugin_Handled;
210 GetClientName(target, arg, sizeof(arg));
212 if (!IsPlayerAlive(target))
214 ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", arg);
215 return Plugin_Handled;
218 ShowActivity(client, "%t", "Slayed player", arg);
219 LogAction(client, target, "\"%L\" slayed \"%L\"", client, target);
220 ForcePlayerSuicide(target);
222 return Plugin_Handled;