Added hack to make plugins open a menu with all possible targets on ReplyToTargetError COMMAND_TARGET_AMBIGUOUS.
Explanation: There are two clients in the server, one named gene, the other one "Ene ~special characters~". An admin issues "sm_slay Ene" and gets following error message: More than one client matched the given pattern. What this hack will do is: Use GetCmdArg(0, ...); to get the command name "sm_slay". Use GetCmdArgString(...); to get the arguments supplied to the command. Use GetLastProcessTargetString(...); (which was implemented in this commit) to retrieve the arguments that were passed to the last ProcessTargetString call. It will then pass this data to the DynamicTargeting plugin through its AmbiguousMenu native. The plugin will open up a menu on the client and list all targets which match the pattern that was supplied to ProcessTargetString. If the client selects a menu entry, FakeClientCommand will be used to re-execute the command with the correct target.
This commit is contained in:
@@ -402,7 +402,14 @@ native void RegAdminCmd(const char[] cmd,
|
||||
const char[] description="",
|
||||
const char[] group="",
|
||||
int flags=0);
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether there is a command callback available.
|
||||
*
|
||||
* @return True if called from inside a command callback.
|
||||
*/
|
||||
native bool IsCommandCallback();
|
||||
|
||||
/**
|
||||
* Returns the number of arguments from the current console or server command.
|
||||
* @note Unlike the HL2 engine call, this does not include the command itself.
|
||||
|
||||
Reference in New Issue
Block a user