plugins/basefuncommands.sp
author Phong Dang <teame06@gmail.com>
Sun Jul 29 00:26:18 2007 +0000 (2007-07-29)
changeset 1200 623603b49096
parent 1194 adc08e6ebe71
child 1212 dd92d898ba63
permissions -rw-r--r--
Fixed AskPluginLoad would still allowed plugin to load even if it returned false.
     1 /**
     2  * basefuncmds.sp
     3  * Implements basic punishment commands.
     4  * This file is part of SourceMod, Copyright (C) 2004-2007 AlliedModders LLC
     5  *
     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.
    10  *
    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.
    15  * 
    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.
    19  *
    20  * Version: $Id$
    21  */
    22 
    23 #pragma semicolon 1
    24 
    25 #include <sourcemod>
    26 #include <sdktools>
    27 
    28 public Plugin:myinfo = 
    29 {
    30 	name = "Basic Fun Commands",
    31 	author = "AlliedModders LLC",
    32 	description = "Basic Fun Commands",
    33 	version = SOURCEMOD_VERSION,
    34 	url = "http://www.sourcemod.net/"
    35 };
    36 
    37 public OnPluginStart()
    38 {
    39 	LoadTranslations("common.phrases");
    40 
    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 }
    45 
    46 public Action:Command_Burn(client, args)
    47 {
    48 	if (args < 1)
    49 	{
    50 		ReplyToCommand(client, "[SM] Usage: sm_burn <#userid|name> [time]");
    51 		return Plugin_Handled;
    52 	}	
    53 	
    54 	decl String:arg[65];
    55 	GetCmdArg(1, arg, sizeof(arg));	
    56 	
    57 	new Float:seconds = 20.0;
    58 	
    59 	if (args > 1)
    60 	{
    61 		decl String:time[20];
    62 		GetCmdArg(2, time, sizeof(time));
    63 		if (StringToFloatEx(time, seconds) == 0)
    64 		{
    65 			ReplyToCommand(client, "[SM] %t", "Invalid Amount");
    66 			return Plugin_Handled;
    67 		}		
    68 	}
    69 	
    70 	new target = FindTarget(client, arg);
    71 	if (target == -1)
    72 	{
    73 		return Plugin_Handled;
    74 	}
    75 	
    76 	GetClientName(target, arg, sizeof(arg));
    77 	
    78 	ShowActivity(client, "%t", "Ignited player", arg);
    79 	LogMessage("\"%L\" ignited \"%L\" (seconds \"%f\")", client, target, seconds);
    80 	IgniteEntity(target, seconds);
    81 	
    82 	return Plugin_Handled;	
    83 }
    84 
    85 public Action:Command_Slap(client, args)
    86 {
    87 	if (args < 1)
    88 	{
    89 		ReplyToCommand(client, "[SM] Usage: sm_slap <#userid|name> [damage]");
    90 		return Plugin_Handled;
    91 	}	
    92 	
    93 	decl String:arg[65];
    94 	GetCmdArg(1, arg, sizeof(arg));	
    95 	
    96 	new damage = 5;
    97 	
    98 	if (args > 1)
    99 	{
   100 		decl String:arg2[20];
   101 		GetCmdArg(2, arg2, sizeof(arg2));
   102 		if (StringToIntEx(arg2, damage) == 0)
   103 		{
   104 			ReplyToCommand(client, "[SM] %t", "Invalid Amount");
   105 			return Plugin_Handled;
   106 		}		
   107 	}
   108 	
   109 	new target = FindTarget(client, arg);
   110 	if (target == -1)
   111 	{
   112 		return Plugin_Handled;
   113 	}
   114 	
   115 	GetClientName(target, arg, sizeof(arg));
   116 	
   117 	ShowActivity(client, "%t", "Slapped player", arg);
   118 	LogMessage("\"%L\" slapped \"%L\" (damage \"%d\")", client, target, damage);
   119 	SlapPlayer(target, damage, true);
   120 	
   121 	return Plugin_Handled;	
   122 }
   123 
   124 public Action:Command_Slay(client, args)
   125 {
   126 	if (args < 1)
   127 	{
   128 		ReplyToCommand(client, "[SM] Usage: sm_slay <#userid|name>");
   129 		return Plugin_Handled;
   130 	}	
   131 	
   132 	decl String:arg[65];
   133 	GetCmdArg(1, arg, sizeof(arg));	
   134 	
   135 	new target = FindTarget(client, arg);
   136 	if (target == -1)
   137 	{
   138 		return Plugin_Handled;
   139 	}
   140 	
   141 	GetClientName(target, arg, sizeof(arg));
   142 	
   143 	ShowActivity(client, "%t", "Slayed player", arg);
   144 	LogMessage("\"%L\" slayed \"%L\"", client, target);
   145 	ForcePlayerSuicide(target);
   146 	
   147 	return Plugin_Handled;	
   148 }