From 7854557480279d491f7f8193d9a8a183664a8c1e Mon Sep 17 00:00:00 2001 From: neon <> Date: Wed, 29 Aug 2018 14:38:31 +0200 Subject: [PATCH] NoSteamPlayerCount: added cvars + cfg file to determine how to deal with fake clients and sourcetv --- NoSteamPlayerCount/scripting/NoSteamPlayerCount.sp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/NoSteamPlayerCount/scripting/NoSteamPlayerCount.sp b/NoSteamPlayerCount/scripting/NoSteamPlayerCount.sp index 5d2e56e4..28f87110 100644 --- a/NoSteamPlayerCount/scripting/NoSteamPlayerCount.sp +++ b/NoSteamPlayerCount/scripting/NoSteamPlayerCount.sp @@ -7,6 +7,9 @@ bool g_bHasFakeClient[MAXPLAYERS + 1] = {false,...}; +Handle g_hCVar_FakeClients = INVALID_HANDLE; +Handle g_hCVar_SourceTV = INVALID_HANDLE; + //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- @@ -32,6 +35,11 @@ public void OnGameFrame() //---------------------------------------------------------------------------------------------------- public void OnPluginStart() { + g_hCVar_FakeClients = CreateConVar("sm_nosteamplayercount_fakeclients", "1", "Increse PlayerCount for Fake Clients", 0, true, 0.0, true, 1.0); + g_hCVar_SourceTV = CreateConVar("sm_nosteamplayercount_sourcetv", "1", "Increse PlayerCount for SourceTV", 0, true, 0.0, true, 1.0); + + AutoExecConfig(true, "plugin.NoSteamPlayerCount"); + RegAdminCmd("sm_addfake", Command_AddFake, ADMFLAG_ROOT, ""); RegAdminCmd("sm_removefake", Command_RemoveFake, ADMFLAG_ROOT, ""); RegAdminCmd("sm_countfakes", Command_CountFakes, ADMFLAG_BAN, ""); @@ -88,6 +96,12 @@ public Action Command_CountFakes(int client, int argc) //---------------------------------------------------------------------------------------------------- public void OnClientAuthorized(int client, const char[] auth) { + if (IsClientSourceTV(client) && (!GetConVarBool(g_hCVar_SourceTV))) + return; + + if (IsFakeClient(client) && (!GetConVarBool(g_hCVar_FakeClients))) + return; + char sSteamID[32]; GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID));