[SNIP] Add a tag for your plugin.
Today I was looking through my server browser, and noticed the lack of tags for game mode indication. I would assume this primarily comes from the fact that sv_tags is a cvar, and I think people are scared of messing with it. With the code here, you will be able to ensure that a tag is always included for your game mode or plugin. Please note this isn't the only way to do this, and probably isn't the most efficient either, but it works.
I didn't code in support for multiple tags per plugin (or at least I didn't intend to)... this can be accomplished easily, but I didn't design this specific example with it in mind. To be honest, one tag is all a plugin should really allocate in order to show it's presence. Code:
#define CUSTOM_TAG "mycoolplugin" |
Re: [SNIP] Add a tag for your plugin.
This is what I use.
You still have to add logic to the below if you are concerned with something else clobbering your tag. This shouldn't be necessary as just manually changing cvars that add/remove tags should still leave it in tact. By the way, if I'm not mistaken, I'm pretty sure sv_tags has a limit of 128 characters (inc. null). Global PHP Code:
PHP Code:
PHP Code:
|
Re: [SNIP] Add a tag for your plugin.
Thanks for contributing. What exactly am I missing?
Quote:
|
Re: [SNIP] Add a tag for your plugin.
Quote:
|
Re: [SNIP] Add a tag for your plugin.
Oh gotcha. Yeah sorry that makes more sense now that I re-read your post.
On a side note, is there enough interest in this to make it an interface? Something as simple as: AddPluginTag("blah"); RemovePluginTag("blah"); You could handle all the logic is one plugin. Let me know. |
Re: [SNIP] Add a tag for your plugin.
Quote:
PHP Code:
|
Re: [SNIP] Add a tag for your plugin.
Yeah, however if sv_tags gets manually changed the hook isn't in place. The include would be perfect if we added one more stock: InitAndHookTags()
|
Re: [SNIP] Add a tag for your plugin.
Quote:
|
Re: [SNIP] Add a tag for your plugin.
Sorry didn't mean it like that, I just meant that with the current include people should be aware that they should probably re-add the tag any time sv_tags is changed. Your code is great as you already know.
|
Re: [SNIP] Add a tag for your plugin.
Quote:
|
All times are GMT -4. The time now is 20:34. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.