AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   3rd party cvar not loaded on plugin_cfg (https://forums.alliedmods.net/showthread.php?t=223713)

Backstabnoob 08-16-2013 10:57

3rd party cvar not loaded on plugin_cfg
 
So I'm registering a cvar in plugin_init:

Code:
register_cvar( "ac_server_table", "classic" )

then trying to get its value on plugin_cfg:

Code:
get_cvar_string( "ac_server_table", g_Server, charsmax( g_Server ) )

Which often gives me the default cvar value. I only managed to make this return the right value each time by delaying it by two seconds, which is not reliable and stupid.

Any ideas?

fysiks 08-18-2013 02:00

Re: 3rd party cvar not loaded on plugin_cfg
 
I've never seen this issue. Where are you setting the cvar?

Backstabnoob 08-18-2013 07:58

Re: 3rd party cvar not loaded on plugin_cfg
 
amxx.cfg

0.5 seconds delay seems to work too, however I don't want to risk loading a wrong cvar value because of some sort of lag that basically copies all of my achievements to an other server on the website. This absolutely needs to be reliable, which is why I'm starting the thread in the first place.

Arkshine 08-18-2013 09:16

Re: 3rd party cvar not loaded on plugin_cfg
 
Well, amxx.cfg is executed in plugin_init() from admin.sma ; and plugin_cfg() is sent at the time as plugin_init(), just right after (from same metamod forward) ; so considering it doesn't use server_exec() in admin.sma, it's possible config file to not be executed right away. Adding server_exec() in admin.sma or adding a small delay in your plugin, both should lead to same wanted result.

Backstabnoob 08-18-2013 10:36

Re: 3rd party cvar not loaded on plugin_cfg
 
Thanks, I'll try it. I'm also going to try adding server_exec directly to plugin_init of my plugin, because I'm going to distribute it to other people.

Edit: I just realized it won't do anything, so nevermind. I'll just delay it then, 0.5 seconds is still fine.


All times are GMT -4. The time now is 15:46.

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