PDA

View Full Version : SPAM console server l4d


bYka
10-24-2014, 13:25
HELLO. HOW TO REMOVE SPAM ON THE SERVER CONSOLE?

so that players do not see the server variables.


http://s020.radikal.ru/i723/1410/19/bbeebffe3bf9.jpg
#include <sourcemod>

#define CVAR_FLAGS FCVAR_PLUGIN


new Handle:g_hGameMode;
new Handle:g_hDifficulty;


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

public OnPluginStart()
{
g_hGameMode = FindConVar("mp_gamemode");
g_hDifficulty = FindConVar("z_difficulty");

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);

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();
}
}

public Action:ResetCheatFlag(Handle:timer, any:flags)
{
SetCommandFlags("reset_gameconvars", _:flags);
}


ExecuteConfig()
{
decl String:sGameMode[16];
decl String:sConfigName[256];

GetConVarString(g_hGameMode, sGameMode, sizeof(sGameMode));

{
LogMessage("Reseting convars");
new flags = GetCommandFlags("reset_gameconvars");
SetCommandFlags("reset_gameconvars", FCVAR_NONE);
ServerCommand("reset_gameconvars");
CreateTimer(0.3, ResetCheatFlag, flags);


// 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);
LogMessage("Executing Config: %s", sConfigName)
ServerCommand("exec %s", sConfigName);
CreateTimer(0.3, ResetCheatFlag, flags);

}


else if (StrEqual(sGameDifficulty, "Normal", false))
{
GetConVarString(g_hConVar_ConfigCoop_Normal, sConfigName, sizeof(sConfigName));
TrimString(sConfigName);
LogMessage("Executing Config: %s", sConfigName)
ServerCommand("exec %s", sConfigName);
CreateTimer(0.3, ResetCheatFlag, flags);

}

else if (StrEqual(sGameDifficulty, "Hard", false))
{
GetConVarString(g_hConVar_ConfigCoop_Hard, sConfigName, sizeof(sConfigName));
TrimString(sConfigName);
LogMessage("Executing Config: %s", sConfigName)
ServerCommand("exec %s", sConfigName);
CreateTimer(0.3, ResetCheatFlag, flags);
}

else if (StrEqual(sGameDifficulty, "Impossible", false))
{
GetConVarString(g_hConVar_ConfigCoop_Impossib le, sConfigName, sizeof(sConfigName));
TrimString(sConfigName);
LogMessage("Executing Config: %s", sConfigName)
ServerCommand("exec %s", sConfigName);
CreateTimer(0.3, ResetCheatFlag, flags);
}

}

}

bl4nk
10-24-2014, 18:42
Are you using sm_cvar in your cfg files?

DJ Data
10-25-2014, 14:20
Use Tidychat