Fixed sm_unban to allow quotes or no quotes around steamid. Remove the quotes around the steamid in the server command removeid.
authorPhong Dang <teame06@gmail.com>
Mon Jul 30 18:45:55 2007 +0000 (2007-07-30)
changeset 12151969daef3f00
parent 1214 e829a7ed101e
child 1216 1063cb3ad1ce
Fixed sm_unban to allow quotes or no quotes around steamid. Remove the quotes around the steamid in the server command removeid.
plugins/basecommands.sp
     1.1 --- a/plugins/basecommands.sp	Mon Jul 30 17:27:30 2007 +0000
     1.2 +++ b/plugins/basecommands.sp	Mon Jul 30 18:45:55 2007 +0000
     1.3 @@ -164,21 +164,31 @@
     1.4  		return Plugin_Handled;
     1.5  	}
     1.6  
     1.7 -	decl String:arg[50];
     1.8 +	decl String:arg[50], String:new_arg[50];
     1.9  	new start=0;
    1.10 -	decl String:new_arg[50];
    1.11  	GetCmdArgString(arg, sizeof(arg));
    1.12  
    1.13 -	if (strncmp(arg, "STEAM_0:", 8) == 0)
    1.14 +	if(arg[start] == '"')
    1.15  	{
    1.16 -		start = 8;
    1.17 -	} else if (strncmp(arg, "0:1:", 4) == 0 || strncmp(arg, "0:0:", 4) == 0)
    1.18 +		start++;
    1.19 +	}
    1.20 +
    1.21 +	if (strncmp(arg[start], "STEAM_0:", 8, false) == 0)
    1.22  	{
    1.23 -		start = 2;
    1.24 +		start += 8;
    1.25 +	} else if (strncmp(arg[start], "0:1:", 4) == 0 || strncmp(arg[start], "0:0:", 4) == 0) {
    1.26 +		start += 2;
    1.27  	}
    1.28  
    1.29  	Format(new_arg, sizeof(new_arg), "STEAM_0:%s", arg[start]);
    1.30  
    1.31 +	/* Remove white spaces */
    1.32 +	new len = TrimString(new_arg);
    1.33 +	if(new_arg[len - 1] == '"')
    1.34 +	{
    1.35 +		new_arg[len - 1] = '\0';
    1.36 +	}
    1.37 +
    1.38  	new Action:act = Plugin_Continue;
    1.39  	Call_StartForward(hBanRemoved);
    1.40  	Call_PushCell(client);
    1.41 @@ -187,13 +197,13 @@
    1.42  
    1.43  	if (act < Plugin_Handled)
    1.44  	{
    1.45 -		LogMessage("\"%L\" removed ban (filter \"%s\")", client, arg[start]);
    1.46 -		ReplyToCommand(client, "[SM] %t", "Removed bans matching", arg);
    1.47 +		LogMessage("\"%L\" removed ban (filter \"%s\")", client, new_arg);
    1.48 +		ReplyToCommand(client, "[SM] %t", "Removed bans matching", new_arg);
    1.49  	}
    1.50  
    1.51  	if (act < Plugin_Stop)
    1.52  	{
    1.53 -		ServerCommand("removeid \"%s\"", arg[start]);
    1.54 +		ServerCommand("removeid %s", new_arg);
    1.55  		ServerCommand("writeid");
    1.56  	}
    1.57