View Single Post
Chi_Nai
BANNED
Join Date: Apr 2018
Location: GB
Old 04-04-2018 , 20:55   Re: [L4D2]Level Difficulty Edit
Reply With Quote #4

Quote:
Originally Posted by Crasher_3637 View Post
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(sMapConfigsizeof(sMapConfig));
    
Format(sMapConfigsizeof(sMapConfig), "cfg/sourcemod/map_cvars/%s.cfg"sMapConfig);
    if (
FileExists(sMapConfigtrue))
    {
        
strcopy(sMapConfigsizeof(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?
Chi_Nai is offline
Send a message via ICQ to Chi_Nai Send a message via AIM to Chi_Nai Send a message via Yahoo to Chi_Nai Send a message via Skype™ to Chi_Nai