Raised This Month: $ Target: $400
 0% 

3rd party cvar not loaded on plugin_cfg


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 08-16-2013 , 10:57   3rd party cvar not loaded on plugin_cfg
Reply With Quote #1

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?
Backstabnoob is offline
Old 08-16-2013, 11:18
wickedd
This message has been deleted by wickedd. Reason: nvm
Old 08-16-2013, 11:58
Backstabnoob
This message has been deleted by Backstabnoob. Reason: Thanks for moving the thread
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-18-2013 , 02:00   Re: 3rd party cvar not loaded on plugin_cfg
Reply With Quote #4

I've never seen this issue. Where are you setting the cvar?
__________________
fysiks is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 08-18-2013 , 07:58   Re: 3rd party cvar not loaded on plugin_cfg
Reply With Quote #5

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.

Last edited by Backstabnoob; 08-18-2013 at 08:01.
Backstabnoob is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-18-2013 , 09:16   Re: 3rd party cvar not loaded on plugin_cfg
Reply With Quote #6

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.
__________________
Arkshine is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 08-18-2013 , 10:36   Re: 3rd party cvar not loaded on plugin_cfg
Reply With Quote #7

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.

Last edited by Backstabnoob; 08-18-2013 at 10:39.
Backstabnoob is offline
Reply


Thread Tools
Display Modes

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 15:46.


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