|
BANNED
Join Date: Apr 2018
Location: GB
|
04-04-2018
, 20:55
Re: [L4D2]Level Difficulty Edit
|
#4
|
Quote:
Originally Posted by Crasher_3637
Why not just code it to where a config is executed based on the map name instead of hard-coding all the official maps?
PHP Code:
public void OnAutoConfigsBuffered()
{
char sMapConfig[128];
GetCurrentMap(sMapConfig, sizeof(sMapConfig));
Format(sMapConfig, sizeof(sMapConfig), "cfg/sourcemod/map_cvars/%s.cfg", sMapConfig);
if (FileExists(sMapConfig, true))
{
strcopy(sMapConfig, sizeof(sMapConfig), sMapConfig[4]);
ServerCommand("exec \"%s\"", sMapConfig);
}
}
If you have a .cfg file in left4dead2/cfg/sourcemod/map_cvars called "c1m1_hotel.cfg" then that config will be executed when you switch to the c1m1_hotel map. It's a lot easier and shorter than what you have now, and it works with custom maps as well.
|
Thanks This is a very early completion of the plugin Can I borrow your code Modify this plugin?
|
|
|
|