plugins/basefuncommands.sp
changeset 1241 2e8046793bc9
parent 1214 e829a7ed101e
child 1268 9360f5ea2289
     1.1 --- a/plugins/basefuncommands.sp	Wed Aug 01 07:18:58 2007 +0000
     1.2 +++ b/plugins/basefuncommands.sp	Wed Aug 01 07:29:40 2007 +0000
     1.3 @@ -46,7 +46,7 @@
     1.4  
     1.5  public Action:Command_Play(client, args)
     1.6  {
     1.7 -	if(args < 2)
     1.8 +	if (args < 2)
     1.9  	{
    1.10  		ReplyToCommand(client, "[SM] Usage: sm_play <#userid|name> <filename>");
    1.11  	}
    1.12 @@ -64,19 +64,19 @@
    1.13  	}
    1.14  
    1.15  	/* Make sure it does not go out of bound by doing "sm_play user  "*/
    1.16 -	if(len == -1)
    1.17 +	if (len == -1)
    1.18  	{
    1.19  		ReplyToCommand(client, "[SM] Usage: sm_play <#userid|name> <filename>");
    1.20  		return Plugin_Handled;
    1.21  	}
    1.22  
    1.23  	/* Incase they put quotes and white spaces after the quotes */
    1.24 -	if(Arguments[len] == '"')
    1.25 +	if (Arguments[len] == '"')
    1.26  	{
    1.27  		len++;
    1.28  		new FileLen = TrimString(Arguments[len]) + len;
    1.29  
    1.30 -		if(Arguments[FileLen - 1] == '"')
    1.31 +		if (Arguments[FileLen - 1] == '"')
    1.32  		{
    1.33  			Arguments[FileLen - 1] = '\0';
    1.34  		}
    1.35 @@ -102,8 +102,21 @@
    1.36  	decl String:arg[65];
    1.37  	GetCmdArg(1, arg, sizeof(arg));
    1.38  
    1.39 +	new target = FindTarget(client, arg);
    1.40 +	if (target == -1)
    1.41 +	{
    1.42 +		return Plugin_Handled;
    1.43 +	}
    1.44 +
    1.45 +	GetClientName(target, arg, sizeof(arg));
    1.46 +	
    1.47 +	if (!IsPlayerAlive(target))
    1.48 +	{
    1.49 +		ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", arg);
    1.50 +		return Plugin_Handled;
    1.51 +	}
    1.52 +	
    1.53  	new Float:seconds = 20.0;
    1.54 -
    1.55  	if (args > 1)
    1.56  	{
    1.57  		decl String:time[20];
    1.58 @@ -115,14 +128,6 @@
    1.59  		}
    1.60  	}
    1.61  
    1.62 -	new target = FindTarget(client, arg);
    1.63 -	if (target == -1)
    1.64 -	{
    1.65 -		return Plugin_Handled;
    1.66 -	}
    1.67 -
    1.68 -	GetClientName(target, arg, sizeof(arg));
    1.69 -
    1.70  	ShowActivity(client, "%t", "Ignited player", arg);
    1.71  	LogMessage("\"%L\" ignited \"%L\" (seconds \"%f\")", client, target, seconds);
    1.72  	IgniteEntity(target, seconds);
    1.73 @@ -141,8 +146,21 @@
    1.74  	decl String:arg[65];
    1.75  	GetCmdArg(1, arg, sizeof(arg));
    1.76  
    1.77 +	new target = FindTarget(client, arg);
    1.78 +	if (target == -1)
    1.79 +	{
    1.80 +		return Plugin_Handled;
    1.81 +	}
    1.82 +
    1.83 +	GetClientName(target, arg, sizeof(arg));
    1.84 +
    1.85 +	if (!IsPlayerAlive(target))
    1.86 +	{
    1.87 +		ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", arg);
    1.88 +		return Plugin_Handled;
    1.89 +	}	
    1.90 +	
    1.91  	new damage = 5;
    1.92 -
    1.93  	if (args > 1)
    1.94  	{
    1.95  		decl String:arg2[20];
    1.96 @@ -154,14 +172,6 @@
    1.97  		}
    1.98  	}
    1.99  
   1.100 -	new target = FindTarget(client, arg);
   1.101 -	if (target == -1)
   1.102 -	{
   1.103 -		return Plugin_Handled;
   1.104 -	}
   1.105 -
   1.106 -	GetClientName(target, arg, sizeof(arg));
   1.107 -
   1.108  	ShowActivity(client, "%t", "Slapped player", arg);
   1.109  	LogMessage("\"%L\" slapped \"%L\" (damage \"%d\")", client, target, damage);
   1.110  	SlapPlayer(target, damage, true);
   1.111 @@ -188,6 +198,12 @@
   1.112  
   1.113  	GetClientName(target, arg, sizeof(arg));
   1.114  
   1.115 +	if (!IsPlayerAlive(target))
   1.116 +	{
   1.117 +		ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", arg);
   1.118 +		return Plugin_Handled;
   1.119 +	}	
   1.120 +
   1.121  	ShowActivity(client, "%t", "Slayed player", arg);
   1.122  	LogMessage("\"%L\" slayed \"%L\"", client, target);
   1.123  	ForcePlayerSuicide(target);