Raised This Month: $ Target: $400
 0% 

Global Shared CVARS - How To ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
kurian
Member
Join Date: Aug 2005
Old 06-05-2007 , 03:23   Global Shared CVARS - How To ?
Reply With Quote #1

I have multiple plugins that share the same CVAR. They function independent of each other.

Any of these plugins can be used together so the problem arises when it comes to the CVAR being registered for the first time.

How do I register a CVAR before hand so that it is available for all plugins to use.

Right now I am doing this in all the plugins (Actually this block is being commonly included from a customized amxmisc.inc)

PHP Code:
    new amx_override_spec get_cvar_pointer("amx_override_spec")
    
    if (!
amx_override_spec)
    {
        
amx_override_spec register_cvar("amx_override_spec","1")
    } 
Basically every plugin checks if the CVAR is already declared and if not declares it. Any further plugins will see the declared CVAR. This isn't a function that is going to be executed repeatedly so the get_cvar_pointer inefficiency is not a problem.

Is there any way to declare a CVAR before hand so that its existence need not be checked each time. I don't really want to create a dummy plugin to do this. And even so it would have to be the FIRST entry in plugins.ini so that it gets executed first.

Is there any command or anything could be placed in amxx.cfg to create a CVAR ?
__________________
[IMG]http://img267.**************/img267/8526/userbarjg9.gif[/IMG]
kurian is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode