|
Senior Member
|
10-13-2022
, 23:26
Re: Help running config
|
#5
|
Quote:
Originally Posted by fysiks
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_list, sizeof cvar_list)
}
public ExecuteGameConfig(cvars[][CVARS], size)
{
for ( new i = 0; i < size; i++ )
{
set_cvar_string(cvars[i][NAME], cvars[i][VALUE]);
}
}
I only tested this by compiling but I believe it should work.
|
Understood thanks friend, working perfectly
__________________
|
|
|
|