Raised This Month: $ Target: $400
 0% 

A simple question...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AceVentura
Member
Join Date: Mar 2020
Location: Ontario, Canada
Old 05-04-2020 , 15:03   A simple question...
Reply With Quote #1

For a cvar to be accessible via a .cfg file, shall i do it like this?

PHP Code:
public plugin_init()
{
    
gCreditKill   =   register_cvar"normal_kill""1" )
    
gCreditHs    =   register_cvar"headshot_kill""2" )
    
gCreditHe    =   register_cvar"henade_kill""3" )
    
gCreditKnife =   register_cvar"knife_kill""5" )
    
gVipCosts     =   register_cvar"vip_costs""3600" )
     
    
LoadConfig()
}

LoadConfig( )
{
    new 
config[64];
    
get_configsdir(configcharsmax(config));
    
add(configcharsmax(config), "/credits.cfg");

    if(
file_exists(config)) 
    {
        
server_cmd("exec %s"config);
        
server_exec();
    }

And, then, add all cvars in the file. (credits.cfg in this case)

credits.cfg
__________________
So.. animals CAN sense evil!

Last edited by AceVentura; 05-04-2020 at 15:11.
AceVentura is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-04-2020 , 15:11   Re: A simple question...
Reply With Quote #2

You should load the cvars in plugin_cfg(), not plugin_init().

PS: no matter how simple the question is, the thread needs to have a descriptive title.
__________________

Last edited by OciXCrom; 05-04-2020 at 15:11.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
AceVentura
Member
Join Date: Mar 2020
Location: Ontario, Canada
Old 05-04-2020 , 15:14   Re: A simple question...
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
You should load the cvars in plugin_cfg(), not plugin_init().
Ah, thanks!
Quote:
Originally Posted by OciXCrom
PS: no matter how simple the question is, the thread needs to have a descriptive title.
Oops, sorry, my bad.
__________________
So.. animals CAN sense evil!
AceVentura is offline
Reply



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 17:09.


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