[INC] Menu Targeting
1 Attachment(s)
I didn't like the behaviour of the stock SM function FindTarget so I made this instead. Issue with FindTarget is that when you type a name and there are multiple matches it does pretty much nothing (other than an error).
This include file defines a stock function SelectTarget that works similar to FindTarget, but opens a menu to the client with all the possible matches if there are more than 1. Best way to explain this is through an example: PHP Code:
If the user input was instead "Taco", there is only 1 match and the callback is called immediately. |
Re: [INC] Menu Targeting
Or, you could just use ProcessTargetString, which is what FindTarget calls internally.
Edit: For an example of how to use it: PHP Code:
|
Re: [INC] Menu Targeting
The loop would apply to all clients that match the target name instead of just the 1. The whole point is you're selecting 1 player through a menu (if there are multiple matches).
You need a callback if the client is gonna be a selecting that player through a menu at a later point. You could use ProcessTargetString in the stock function itself and wrap it with the menu/callback stuff but I had issues with it before in terms of bot/self selection so I do the StrContains with all clients instead. |
Re: [INC] Menu Targeting
ProcessTargetString doesn't even support multiple targets via display name. It only populates the array with multiple targets if a multi target filter was used, like @all.
If multiple targets match a partial name, then ProcessTargetString returns COMMAND_TARGET_AMBIGUOUS. |
Re: [INC] Menu Targeting
Thank you for making this. :bacon!::bacon!::bacon!:
|
All times are GMT -4. The time now is 18:22. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.