Raised This Month: $77 Target: $400
 19% 

[L4D & L4D2] Game Mode Config Loader 1.6


Post New Thread Reply   
 
Thread Tools Display Modes
crazydog
SourceMod Donor
Join Date: Jan 2006
Old 11-11-2009 , 19:34   Re: [L4D] Game Mode Config Loader
Reply With Quote #41

Just FYI, this needs to be updated for the new "teamversus" game type.
crazydog is offline
Thraka
AlliedModders Donor
Join Date: Aug 2005
Old 11-11-2009 , 21:28   Re: [L4D] Game Mode Config Loader 1.5
Reply With Quote #42

Thanks crazydog, didn't know about that new mode. Wow only took them a year to add it...

Updated.
Thraka is offline
triggerman
Senior Member
Join Date: Jun 2009
Old 11-14-2009 , 00:24   Re: [L4D] Game Mode Config Loader 1.5
Reply With Quote #43

great plugin! i use it to enable and disable other plugins that are versus or coop specific. works excellently for those plugins that work great in one gamemode and have adverse affects on the others.
triggerman is offline
Thraka
AlliedModders Donor
Join Date: Aug 2005
Old 11-20-2009 , 17:12   Re: [L4D] Game Mode Config Loader 1.5
Reply With Quote #44

Added l4d2 modes.
Thraka is offline
Jоnny
Senior Member
Join Date: Jun 2007
Old 11-23-2009 , 05:26   Re: [L4D] Game Mode Config Loader 1.5
Reply With Quote #45

Added realism easy/normal/coop/impossible modes ^^

Code:
/* Plugin Template generated by Pawn Studio */

// Thanks DJ Tsunami 

#include <sourcemod>

#define CVAR_FLAGS FCVAR_PLUGIN
#define PLUGIN_VERSION "1.7"

public Plugin:myinfo = 
{
    name = "Game Mode Config Loader",
    author = "Thraka",
    description = "Executes a config file based on the current mp_gamemode and z_difficulty",
    version = PLUGIN_VERSION,
    url = "http://forums.alliedmods.net/showthread.php?t=93212"
}

new Handle:g_hGameMode;
new Handle:g_hDifficulty;

//coop,realism,survival,versus,teamversus,scavenge,teamscavenge

new Handle:g_hConVar_ConfigCoop;
new Handle:g_hConVar_ConfigVersus;
new Handle:g_hConVar_ConfigTeamVersus;
new Handle:g_hConVar_ConfigSurvival;
new Handle:g_hConVar_ConfigRealism;
new Handle:g_hConVar_ConfigScavenge;
new Handle:g_hConVar_ConfigTeamScavenge;


new Handle:g_hConVar_ConfigCoop_Easy;
new Handle:g_hConVar_ConfigCoop_Normal;
new Handle:g_hConVar_ConfigCoop_Hard;
new Handle:g_hConVar_ConfigCoop_Impossible;

new Handle:g_hConVar_ConfigReal_Easy;
new Handle:g_hConVar_ConfigReal_Normal;
new Handle:g_hConVar_ConfigReal_Hard;
new Handle:g_hConVar_ConfigReal_Impossible;

public OnPluginStart()
{
    g_hGameMode = FindConVar("mp_gamemode");        //coop, versus, survival
    g_hDifficulty = FindConVar("z_difficulty");        //Easy, Normal, Hard, Impossible
    
    CreateConVar("gamemode_config_ver", PLUGIN_VERSION, "Version of the game mode config loader plugin.", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_NOTIFY);

    g_hConVar_ConfigCoop = CreateConVar("gamemode_config_coop", "coop.cfg", "CFG file to execute when game mode is coop.", CVAR_FLAGS);
    g_hConVar_ConfigVersus = CreateConVar("gamemode_config_versus", "versus.cfg", "CFG file to execute when game mode is versus.", CVAR_FLAGS);
    g_hConVar_ConfigTeamVersus = CreateConVar("gamemode_config_teamversus", "teamversus.cfg", "CFG file to execute when game mode is teamversus.", CVAR_FLAGS);
    g_hConVar_ConfigSurvival = CreateConVar("gamemode_config_survival", "survival.cfg", "CFG file to execute when game mode is survival.", CVAR_FLAGS);
    g_hConVar_ConfigRealism = CreateConVar("gamemode_config_realism", "realism.cfg", "CFG file to execute when game mode is realism.", CVAR_FLAGS);
    g_hConVar_ConfigScavenge = CreateConVar("gamemode_config_scavenge", "scavenge.cfg", "CFG file to execute when game mode is scavenge.", CVAR_FLAGS);
    g_hConVar_ConfigTeamScavenge = CreateConVar("gamemode_config_teamscavenge", "teamscavenge.cfg", "CFG file to execute when game mode is teamscavenge.", CVAR_FLAGS);
    
    
    g_hConVar_ConfigCoop_Easy = CreateConVar("gamemode_config_coop_easy", "coop_easy.cfg", "CFG file to execute when game mode is coop and the difficulty is Easy.", CVAR_FLAGS);
    g_hConVar_ConfigCoop_Normal = CreateConVar("gamemode_config_coop_normal", "coop_normal.cfg", "CFG file to execute when game mode is coop and the difficulty is Normal.", CVAR_FLAGS);
    g_hConVar_ConfigCoop_Hard = CreateConVar("gamemode_config_coop_hard", "coop_hard.cfg", "CFG file to execute when game mode is coop and the difficulty is Advanced.", CVAR_FLAGS);
    g_hConVar_ConfigCoop_Impossible = CreateConVar("gamemode_config_coop_impossible", "coop_impossible.cfg", "CFG file to execute when game mode is coop and the difficulty is Expert.", CVAR_FLAGS);

    g_hConVar_ConfigReal_Easy = CreateConVar("gamemode_config_realism_easy", "realism_easy.cfg", "CFG file to execute when game mode is realism and the difficulty is Easy.", CVAR_FLAGS);
    g_hConVar_ConfigReal_Normal = CreateConVar("gamemode_config_realism_normal", "realism_normal.cfg", "CFG file to execute when game mode is realism and the difficulty is Normal.", CVAR_FLAGS);
    g_hConVar_ConfigReal_Hard = CreateConVar("gamemode_config_realism_hard", "realism_hard.cfg", "CFG file to execute when game mode is realism and the difficulty is Advanced.", CVAR_FLAGS);
    g_hConVar_ConfigReal_Impossible = CreateConVar("gamemode_config_realism_impossible", "realism_impossible.cfg", "CFG file to execute when game mode is realism and the difficulty is Expert.", CVAR_FLAGS);
    
    HookConVarChange(g_hGameMode, ConVarChange_GameMode);
    HookConVarChange(g_hDifficulty, ConVarChange_Difficulty);
}

public OnMapStart()
{
    ExecuteConfig();
}

public ConVarChange_GameMode(Handle:convar, const String:oldValue[], const String:newValue[])
{
    if (strcmp(oldValue, newValue) != 0)
    {
        ExecuteConfig();
    }
}

public ConVarChange_Difficulty(Handle:convar, const String:oldValue[], const String:newValue[])
{
    if (strcmp(oldValue, newValue) != 0)
    {
        ExecuteConfig();
    }
}

ExecuteConfig()
{
    decl String:sGameMode[16];
    decl String:sConfigName[256];
    
    GetConVarString(g_hGameMode, sGameMode, sizeof(sGameMode));

    if (StrEqual(sGameMode, "coop", false))
    {
        GetConVarString(g_hConVar_ConfigCoop, sConfigName, sizeof(sConfigName));
        TrimString(sConfigName);
        ServerCommand("exec %s", sConfigName);
        
        // Exec difficulty
        decl String:sGameDifficulty[16];
        GetConVarString(g_hDifficulty, sGameDifficulty, sizeof(sGameDifficulty));
        
        if (StrEqual(sGameDifficulty, "Easy", false))
        {
            GetConVarString(g_hConVar_ConfigCoop_Easy, sConfigName, sizeof(sConfigName));
            TrimString(sConfigName);
            ServerCommand("exec %s", sConfigName);
        }
        
        else if (StrEqual(sGameDifficulty, "Normal", false))
        {
            GetConVarString(g_hConVar_ConfigCoop_Normal, sConfigName, sizeof(sConfigName));
            TrimString(sConfigName);
            ServerCommand("exec %s", sConfigName);
        }
        
        else if (StrEqual(sGameDifficulty, "Hard", false))
        {
            GetConVarString(g_hConVar_ConfigCoop_Hard, sConfigName, sizeof(sConfigName));
            TrimString(sConfigName);
            ServerCommand("exec %s", sConfigName);
        }
        
        else if (StrEqual(sGameDifficulty, "Impossible", false))
        {
            GetConVarString(g_hConVar_ConfigCoop_Impossible, sConfigName, sizeof(sConfigName));
            TrimString(sConfigName);
            ServerCommand("exec %s", sConfigName);
        }
        
    }
    
    
    else if (StrEqual(sGameMode, "survival", false))
    {
        GetConVarString(g_hConVar_ConfigSurvival, sConfigName, sizeof(sConfigName));
        TrimString(sConfigName);
        ServerCommand("exec %s", sConfigName);
        
    }
    
    
    else if (StrEqual(sGameMode, "versus", false))
    {
        
        GetConVarString(g_hConVar_ConfigVersus, sConfigName, sizeof(sConfigName));
        TrimString(sConfigName);
        ServerCommand("exec %s", sConfigName);
    }
    
    else if (StrEqual(sGameMode, "teamversus", false))
    {
        
        GetConVarString(g_hConVar_ConfigTeamVersus, sConfigName, sizeof(sConfigName));
        TrimString(sConfigName);
        ServerCommand("exec %s", sConfigName);
    }
    
    else if (StrEqual(sGameMode, "realism", false))
    {
        GetConVarString(g_hConVar_ConfigRealism, sConfigName, sizeof(sConfigName));
        TrimString(sConfigName);
        ServerCommand("exec %s", sConfigName);
        
        // Exec difficulty
        decl String:sGameDifficulty[16];
        GetConVarString(g_hDifficulty, sGameDifficulty, sizeof(sGameDifficulty));
        
        if (StrEqual(sGameDifficulty, "Easy", false))
        {
            GetConVarString(g_hConVar_ConfigReal_Easy, sConfigName, sizeof(sConfigName));
            TrimString(sConfigName);
            ServerCommand("exec %s", sConfigName);
        }
        
        else if (StrEqual(sGameDifficulty, "Normal", false))
        {
            GetConVarString(g_hConVar_ConfigReal_Normal, sConfigName, sizeof(sConfigName));
            TrimString(sConfigName);
            ServerCommand("exec %s", sConfigName);
        }
        
        else if (StrEqual(sGameDifficulty, "Hard", false))
        {
            GetConVarString(g_hConVar_ConfigReal_Hard, sConfigName, sizeof(sConfigName));
            TrimString(sConfigName);
            ServerCommand("exec %s", sConfigName);
        }
        
        else if (StrEqual(sGameDifficulty, "Impossible", false))
        {
            GetConVarString(g_hConVar_ConfigReal_Impossible, sConfigName, sizeof(sConfigName));
            TrimString(sConfigName);
            ServerCommand("exec %s", sConfigName);
        }
        
    }
    
    else if (StrEqual(sGameMode, "scavenge", false))
    {
        
        GetConVarString(g_hConVar_ConfigScavenge, sConfigName, sizeof(sConfigName));
        TrimString(sConfigName);
        ServerCommand("exec %s", sConfigName);
    }
    
    else if (StrEqual(sGameMode, "teamscavenge", false))
    {
        
        GetConVarString(g_hConVar_ConfigTeamScavenge, sConfigName, sizeof(sConfigName));
        TrimString(sConfigName);
        ServerCommand("exec %s", sConfigName);
    }
}
Jоnny is offline
coyaks
New Member
Join Date: Nov 2009
Old 11-26-2009 , 02:40   Re: [L4D & L4D2] Game Mode Config Loader 1.6
Reply With Quote #46

Any intruction on how to use this thing?
coyaks is offline
coyaks
New Member
Join Date: Nov 2009
Old 11-26-2009 , 02:53   Re: [L4D & L4D2] Game Mode Config Loader 1.6
Reply With Quote #47

hi can anyone please help me. i just got new 8 slot l4d2 server which is in default mode is coop. Sometimes i wanted to change the game mode to something else other than just coop.

i have downloaded the file above but havent got a clue how to use it, where to put it no instructions been put .

i got l4d server which is no problem for me to change game modes. but this one im havent got any clue.

please reply.
coyaks is offline
madcap
Senior Member
Join Date: Feb 2009
Old 11-26-2009 , 09:54   Re: [L4D & L4D2] Game Mode Config Loader 1.6
Reply With Quote #48

This plugin doesn't change the game mode. This plugin just runs a different cfg file based on what the current gamemode is. You'd use this if for example you wanted to modify the default behavior of VS but not Coop.
madcap is offline
[-NM-] cal70d
Member
Join Date: Mar 2009
Old 11-27-2009 , 11:27   Re: [L4D & L4D2] Game Mode Config Loader 1.6
Reply With Quote #49

This plugin is working great on my L4D2 server.
I use it to load/unload plugins for the different gamemodes.
(Not all plugins work or are needed for all gamemodes.)

Thanks for a wonderful plugin.
[-NM-] cal70d is offline
cigs
Senior Member
Join Date: Jul 2006
Old 12-05-2009 , 14:12   Re: [L4D & L4D2] Game Mode Config Loader 1.6
Reply With Quote #50

As much as I would like to use this plugin, it fails at loading the c1m3_mall Dead Center Mall level when this plugin is installed.

I've tried the original smx, and a recompiled smx. But each time, when this level is loaded from c1m2_streets to c1m3_mall or c1m3_mall loaded directly from lobby, it gives a message stating "The server was shut down because all players were idle", click OK.

The console outputs "Diconnect: Kicked by console: All Players idle."

When the plugin is removed from the sourcemod plugins folder, there're no problems at all.

Other plugins I have installed:
l4d2blackandwhite.smx
l4d2drop.smx
l4d2infectedbots.smx
l4d2playerjoin.smx
l4d2unstick.smx
l4d2weaponspawner.smx
__________________

Last edited by cigs; 12-05-2009 at 14:19.
cigs is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:21.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode