3 * Implements basic punishment commands.
4 * This file is part of SourceMod, Copyright (C) 2004-2007 AlliedModders LLC
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 public Plugin:myinfo =
30 name = "Basic Fun Commands",
31 author = "AlliedModders LLC",
32 description = "Basic Fun Commands",
33 version = SOURCEMOD_VERSION,
34 url = "http://www.sourcemod.net/"
37 public OnPluginStart()
39 LoadTranslations("common.phrases");
41 RegAdminCmd("sm_burn", Command_Burn, ADMFLAG_SLAY, "sm_burn <#userid|name> [time]");
42 RegAdminCmd("sm_slap", Command_Slap, ADMFLAG_SLAY, "sm_slap <#userid|name> [damage]");
43 RegAdminCmd("sm_slay", Command_Slay, ADMFLAG_SLAY, "sm_slay <#userid|name>");
44 RegAdminCmd("sm_play", Command_Play, ADMFLAG_GENERIC, "sm_play <#userid|name> <filename>");
47 public Action:Command_Play(client, args)
51 ReplyToCommand(client, "[SM] Usage: sm_play <#userid|name> <filename>");
54 new String:Arguments[PLATFORM_MAX_PATH + 65];
55 GetCmdArgString(Arguments, sizeof(Arguments));
58 new len = BreakString(Arguments, Arg, sizeof(Arg));
60 new target = FindTarget(client, Arg);
63 return Plugin_Handled;
66 /* Make sure it does not go out of bound by doing "sm_play user "*/
69 ReplyToCommand(client, "[SM] Usage: sm_play <#userid|name> <filename>");
70 return Plugin_Handled;
73 /* Incase they put quotes and white spaces after the quotes */
74 if(Arguments[len] == '"')
77 new FileLen = TrimString(Arguments[len]) + len;
79 if(Arguments[FileLen - 1] == '"')
81 Arguments[FileLen - 1] = '\0';
85 GetClientName(target, Arg, sizeof(Arg));
86 ShowActivity(client, "%t", "Played Sound", Arg);
87 LogMessage("\"%L\" played sound on \"%L\" (file \"%s\")", client, target, Arguments[len]);
89 ClientCommand(target, "playgamesound \"%s\"", Arguments[len]);
91 return Plugin_Handled;
94 public Action:Command_Burn(client, args)
98 ReplyToCommand(client, "[SM] Usage: sm_burn <#userid|name> [time]");
99 return Plugin_Handled;
103 GetCmdArg(1, arg, sizeof(arg));
105 new Float:seconds = 20.0;
109 decl String:time[20];
110 GetCmdArg(2, time, sizeof(time));
111 if (StringToFloatEx(time, seconds) == 0)
113 ReplyToCommand(client, "[SM] %t", "Invalid Amount");
114 return Plugin_Handled;
118 new target = FindTarget(client, arg);
121 return Plugin_Handled;
124 GetClientName(target, arg, sizeof(arg));
126 ShowActivity(client, "%t", "Ignited player", arg);
127 LogMessage("\"%L\" ignited \"%L\" (seconds \"%f\")", client, target, seconds);
128 IgniteEntity(target, seconds);
130 return Plugin_Handled;
133 public Action:Command_Slap(client, args)
137 ReplyToCommand(client, "[SM] Usage: sm_slap <#userid|name> [damage]");
138 return Plugin_Handled;
142 GetCmdArg(1, arg, sizeof(arg));
148 decl String:arg2[20];
149 GetCmdArg(2, arg2, sizeof(arg2));
150 if (StringToIntEx(arg2, damage) == 0)
152 ReplyToCommand(client, "[SM] %t", "Invalid Amount");
153 return Plugin_Handled;
157 new target = FindTarget(client, arg);
160 return Plugin_Handled;
163 GetClientName(target, arg, sizeof(arg));
165 ShowActivity(client, "%t", "Slapped player", arg);
166 LogMessage("\"%L\" slapped \"%L\" (damage \"%d\")", client, target, damage);
167 SlapPlayer(target, damage, true);
169 return Plugin_Handled;
172 public Action:Command_Slay(client, args)
176 ReplyToCommand(client, "[SM] Usage: sm_slay <#userid|name>");
177 return Plugin_Handled;
181 GetCmdArg(1, arg, sizeof(arg));
183 new target = FindTarget(client, arg);
186 return Plugin_Handled;
189 GetClientName(target, arg, sizeof(arg));
191 ShowActivity(client, "%t", "Slayed player", arg);
192 LogMessage("\"%L\" slayed \"%L\"", client, target);
193 ForcePlayerSuicide(target);
195 return Plugin_Handled;