View Single Post
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 11-12-2017 , 07:44   Re: Make plugin_prechase called after plugin_cfg
Reply With Quote #30

I don't think the game cares when you register or change cvars or execute config files. I guess I'll test it.

EDIT:
Tested, works. If I change the cvar in the file and change the map, I retrieve the new value.
PHP Code:
#include <amxmodx>
#include <amxmisc>

#pragma semicolon true

public plugin_init()
{
    
register_plugin("Cvars Test""1.0.0""KliPPy");
}

public 
plugin_precache()
{
    new const 
testCvar register_cvar("my_test_cvar""1337");
    new 
configFilePath[256];
    
    
get_configsdir(configFilePathcharsmax(configFilePath));
    
add(configFilePathcharsmax(configFilePath), "/cvartest.cfg");
    
server_cmd("exec %s"configFilePath);
    
server_exec();
    
    
log_amx("my_test_cvar = %i"get_pcvar_num(testCvar));


Last edited by klippy; 11-12-2017 at 07:58.
klippy is offline