View Single Post
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-13-2022 , 21:00   Re: Help running config
Reply With Quote #4

To use a variable that is defined with an enum, you have to index it with the enum members. For example, if defined a variable with the CVARS enum like this:

PHP Code:
new aCvar[CVARS
Then you would use the aCvar variable like this:

PHP Code:
server_print("CvarName: %s"aCvar[NAME])
server_print("CvarValue: %s, aCvar[VALUE]) 
So, if you're doing this with an array of the CVARS enum like you do, you would include the index for the first dimension:

PHP Code:
server_print("CvarName: %s"cvar_list[i][NAME])
server_print("CvarValue: %s, cvar_list[i][VALUE]) 
Then, to be able to pass the variable into the function, I ended up having to do this:

PHP Code:
public Function()
{
    
ExecuteGameConfig(cvar_listsizeof cvar_list)
}

public 
ExecuteGameConfig(cvars[][CVARS], size)
{
    for ( new 
0sizei++ )
    {
        
set_cvar_string(cvars[i][NAME], cvars[i][VALUE]);
    }

I only tested this by compiling but I believe it should work.
__________________
fysiks is offline