Hello,
Context:
Auto configuration was an idea I had (maybe some of you had it aswell) to configure specific settings for each map.
Here it is:
I modified every mapname.gsc in the maps/mp/ directory, and, basically, I added this to the beginning:
Code:
if(getCvar("scr_autoconfig") == "1"){
mapname = getcvar("mapname");
setCvar("scr_allow_fraggrenades", (getCvar("scr_allow_fraggrenades_" + mapname)));
setCvar("scr_allow_smokegrenades", (getCvar("scr_allow_smokegrenades_" + mapname)));
setCvar("scr_allow_sprint", (getCvar("scr_allow_sprint_" + mapname)));
}
This allows me to define if there's going to be fraggrenades / smokegrenades / sprint in any map that has autoconfig implemented.
At the moment, I'm using auto config with MOAM (mod of all menus) - which allows me to define if there's gonna be all weapons or regular weapons or rifles only or pistols only in a map, but I won't post the code unless someone asks me, it's a bit long and unnecessary here.
The problem:
It is working perfectly right now, but I still think it can be improved.
Like, if I wanted to add another configuration, e. g. scr_tdm_scorelimit, I would have to modify the mod to add:
Code:
setCvar("scr_tdm_scorelimit", (getCvar("scr_tdm_scorelimit_" + mapname)));
And we all know that, when you modify a mod in a pure server, you need to change your fs_game, or the players who have downloaded the previous mod will have conflicts.
So, basically, what I need to know is the command to execute a .cfg file from the script. I'm not good with syntax, I really have no clue if there is how.
It would look like:
Code:
mapname = getcvar("mapname");
exec(mapname + ".cfg");
But this does not work - I get the unknown function error report when I try it.
mp_breakout.gsc is attached with the current configuration I'm using on my mod.
Does anybody know if there is such a script command to exec a .cfg file? I think this can be very useful, and I also hope this idea was useful.