new bool:bOpposite;
if(StrContains(strPattern, "!") == -1)
bOpposite = true;
As I'm sure you're already aware, StrContains returns -1 if the string was NOT found. So you're setting bOpposite to true if ! was NOT in the @filter.
I find it a little bit ridiculous that the plugin has been downloaded 70 times with NO ONE ELSE reporting these errors over the last 4 months until WildCard chimed in.
Also, you should add this to OnPluginEnd(). Unlike most other things, Sourcemod does NOT seem to automatically handle this when a plugin is unloaded.
Use Tries and ignore first character (@) (and (!) if opposite), so strPattern[1] will return 'spies' instead of @spies and so on.
ReFlexPoison
02-07-2014 18:08
Re: [TF2] Class Target Filters
Quote:
Originally Posted by ddhoward
(Post 2096968)
As I'm sure you're already aware, StrContains returns -1 if the string was NOT found. So you're setting bOpposite to true if ! was NOT in the @filter.
Also, you should add this to OnPluginEnd(). Unlike most other things, Sourcemod does NOT seem to automatically handle this when a plugin is unloaded.
I released this plugin with relatively no testing, thanks for catching that. Updated with the above changes.
Mitchell
02-26-2014 13:02
Re: [TF2] Class Target Filters (v1.3 - 2/7/14)
I ended up making a new fork of this (not official)
I have yet to test any of it, but it compiles (good enough right?)
I've named it to Super Targeting, since ive used your code as a base (which has barely any of it left) i'm asking you if you want to convert this thread into that, or if you would rather start a new thread.
After i get to do the testing for this plugin it should be able to have things added on, hence the 'super' in "Super Targeting".
There is a config for server operators to add onto, right now it has 278 filters in it. There is little to no documentation on how the config is setup, i will soon be adding onto that. The idea is solid and would make your plugin obsolete. And honestly I didn't like how most of this was hard-coded into the plugin, giving operators no control over what filters they actually want, or even use.
But anyways, the Repo is over here: https://bitbucket.org/MitchDizzle/super-targeting feel free to check it out. Once i test it either by tommorrow it will be read for a release.
Run-Down of Super Targeting Features:
This plugin allows a simple config to be added and server operators are allowed to customize how the filters work. If you wanted to add a filter such as @ihateeveryone to filter everybody it's possible! or if you wanted to define @ihateblue to target all blue players you could do that also. If you would like to customize the message that is outputted that is possible too! So say you define @custom to have a message of 'all players in my custom filter' it would print out "Admin: targeted all players in my custom filter', or depending on the plugin that uses the process string, etc.