plugins/basebans.sp
changeset 1627 de86e6e12204
parent 1625 8e4a6a8c3256
child 1672 92764e877da1
     1.1 --- a/plugins/basebans.sp	Mon Oct 22 02:05:51 2007 +0000
     1.2 +++ b/plugins/basebans.sp	Mon Oct 22 02:54:27 2007 +0000
     1.3 @@ -116,26 +116,42 @@
     1.4  		return Plugin_Handled;
     1.5  	}
     1.6  	
     1.7 -	new clients[1];
     1.8 -	new numClients = SearchForClients(arg, clients, 1);
     1.9 -
    1.10 +	decl String:target_name[MAX_TARGET_LENGTH];
    1.11 +	decl target_list[1], bool:tn_is_ml;
    1.12 +	new found_client = -1;
    1.13 +	
    1.14 +	if (ProcessTargetString(
    1.15 +			arg,
    1.16 +			client, 
    1.17 +			target_list, 
    1.18 +			1, 
    1.19 +			COMMAND_FILTER_CONNECTED|COMMAND_FILTER_NO_MULTI,
    1.20 +			target_name,
    1.21 +			sizeof(target_name),
    1.22 +			tn_is_ml) > 0)
    1.23 +	{
    1.24 +		found_client = target_list[0];
    1.25 +	}
    1.26 +	
    1.27  	new bool:has_rcon;
    1.28  	
    1.29  	if (client == 0 || (client == 1 && !IsDedicatedServer()))
    1.30  	{
    1.31  		has_rcon = true;
    1.32 -	} else {
    1.33 +	}
    1.34 +	else
    1.35 +	{
    1.36  		new AdminId:id = GetUserAdmin(client);
    1.37  		has_rcon = (id == INVALID_ADMIN_ID) ? false : GetAdminFlag(id, Admin_RCON);
    1.38  	}
    1.39  	
    1.40  	new hit_client = -1;
    1.41 -	if (numClients == 1 
    1.42 -		&& !IsFakeClient(clients[0])
    1.43 -		&& (has_rcon || CanUserTarget(client, clients[0])))
    1.44 +	if (found_client != -1
    1.45 +		&& !IsFakeClient(found_client)
    1.46 +		&& (has_rcon || CanUserTarget(client, found_client)))
    1.47  	{
    1.48 -		GetClientIP(clients[0], arg, sizeof(arg));
    1.49 -		hit_client = clients[0];
    1.50 +		GetClientIP(found_client, arg, sizeof(arg));
    1.51 +		hit_client = found_client;
    1.52  	}
    1.53  	
    1.54  	if (hit_client == -1 && !has_rcon)
    1.55 @@ -146,7 +162,7 @@
    1.56  
    1.57  	new minutes = StringToInt(time);
    1.58  
    1.59 -	decl String:reason[128];
    1.60 +	new String:reason[128];
    1.61  	if (args >= 3)
    1.62  	{
    1.63  		GetCmdArg(3, reason, sizeof(reason));
    1.64 @@ -159,14 +175,20 @@
    1.65  			  minutes, 
    1.66  			  arg, 
    1.67  			  reason);
    1.68 +				
    1.69 +	ReplyToCommand(client, "[SM] %t", "Ban added");
    1.70 +	
    1.71  	BanIdentity(arg, 
    1.72  				minutes, 
    1.73  				BANFLAG_IP, 
    1.74  				reason, 
    1.75  				"sm_banip", 
    1.76  				client);
    1.77 -
    1.78 -	ReplyToCommand(client, "[SM] %t", "Ban added");
    1.79 +				
    1.80 +	if (hit_client != -1)
    1.81 +	{
    1.82 +		KickClient(hit_client, "Banned: %s", reason);
    1.83 +	}
    1.84  
    1.85  	return Plugin_Handled;
    1.86  }