NoSteamManager: Add convars.

This commit is contained in:
zaCade 2018-03-26 21:44:05 +02:00
parent d56ccc5d0e
commit f1e08a6ee4

View File

@ -6,6 +6,10 @@
#pragma newdecls required
/* CONVARS */
ConVar g_hCvar_BlockAdmin;
ConVar g_hCvar_BlockVoice;
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
@ -22,11 +26,16 @@ public Plugin myinfo =
//----------------------------------------------------------------------------------------------------
public void OnPluginStart()
{
g_hCvar_BlockAdmin = CreateConVar("sm_nosteam_block_admin", "1", "Should people marked as nosteam be blocked from admin?", FCVAR_PLUGIN, true, 0.0, true, 1.0);
g_hCvar_BlockVoice = CreateConVar("sm_nosteam_block_voice", "1", "Should people marked as nosteam be blocked from voice?", FCVAR_PLUGIN, true, 0.0, true, 1.0);
AddMultiTargetFilter("@steam", Filter_Steam, "Steam Players", false);
AddMultiTargetFilter("@nosteam", Filter_NoSteam, "No-Steam Players", false);
RegConsoleCmd("sm_nosteam", Command_DisplaySteamStats, "Shows the number of Steam and No-Steam players");
RegConsoleCmd("sm_steam", Command_DisplaySteamStats, "Shows the number of Steam and No-Steam players");
AutoExecConfig();
}
//----------------------------------------------------------------------------------------------------
@ -116,6 +125,9 @@ public bool Filter_NoSteam(const char[] sPattern, Handle hClients)
//----------------------------------------------------------------------------------------------------
public Action OnClientPreAdminCheck(int client)
{
if (!g_hCvar_BlockAdmin.BoolValue)
return Plugin_Continue;
if (IsFakeClient(client) || IsClientSourceTV(client))
return Plugin_Continue;
@ -138,6 +150,9 @@ public Action OnClientPreAdminCheck(int client)
//----------------------------------------------------------------------------------------------------
public void OnClientPostAdminCheck(int client)
{
if (!g_hCvar_BlockVoice.BoolValue)
return;
if (IsFakeClient(client) || IsClientSourceTV(client))
return;