core/smn_console.cpp
changeset 3389 68d3e56f4bb7
parent 3373 c6463cdc2180
child 3416 7cb415ecd933
     1.1 --- a/core/smn_console.cpp	Fri Sep 09 15:29:17 2011 -0400
     1.2 +++ b/core/smn_console.cpp	Sat Sep 10 12:08:38 2011 -0400
     1.3 @@ -1257,7 +1257,7 @@
     1.4  	char *cmd;
     1.5  	pContext->LocalToString(params[2], &cmd);
     1.6  
     1.7 -	/* Auto-detect a command if we can */
     1.8 +	/* Match up with an admin command if possible */
     1.9  	FlagBits bits = params[3];
    1.10  	bool found_command = false;
    1.11  	if (params[0] < 4 || !params[4])
    1.12 @@ -1270,7 +1270,28 @@
    1.13  		g_Admins.GetCommandOverride(cmd, Override_Command, &bits);
    1.14  	}
    1.15  
    1.16 -	return g_ConCmds.CheckCommandAccess(params[1], cmd, bits) ? 1 : 0;
    1.17 +	return g_ConCmds.CheckClientCommandAccess(params[1], cmd, bits) ? 1 : 0;
    1.18 +}
    1.19 +
    1.20 +static cell_t CheckAccess(IPluginContext *pContext, const cell_t *params)
    1.21 +{
    1.22 +	char *cmd;
    1.23 +	pContext->LocalToString(params[2], &cmd);
    1.24 +
    1.25 +	/* Match up with an admin command if possible */
    1.26 +	FlagBits bits = params[3];
    1.27 +	bool found_command = false;
    1.28 +	if (params[0] < 4 || !params[4])
    1.29 +	{
    1.30 +		found_command = g_ConCmds.LookForCommandAdminFlags(cmd, &bits);
    1.31 +	}
    1.32 +	
    1.33 +	if (!found_command)
    1.34 +	{
    1.35 +		g_Admins.GetCommandOverride(cmd, Override_Command, &bits);
    1.36 +	}
    1.37 +
    1.38 +	return g_ConCmds.CheckAdminCommandAccess(params[1], cmd, bits) ? 1 : 0;
    1.39  }
    1.40  
    1.41  static cell_t IsChatTrigger(IPluginContext *pContext, const cell_t *params)
    1.42 @@ -1521,6 +1542,7 @@
    1.43  	{"GetCommandIterator",	GetCommandIterator},
    1.44  	{"ReadCommandIterator",	ReadCommandIterator},
    1.45  	{"CheckCommandAccess",	CheckCommandAccess},
    1.46 +	{"CheckAccess",			CheckAccess},
    1.47  	{"FakeClientCommandEx",	FakeClientCommandEx},
    1.48  	{"IsChatTrigger",		IsChatTrigger},
    1.49  	{"SetCommandFlags",		SetCommandFlags},