From 6736a43837e4324ead8e4c677b254d4d1303b23d Mon Sep 17 00:00:00 2001 From: neon <> Date: Wed, 29 Aug 2018 15:44:30 +0200 Subject: [PATCH] toolazytoexplain --- .../scripting/NoSteamPlayerCount.sp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/NoSteamPlayerCount/scripting/NoSteamPlayerCount.sp b/NoSteamPlayerCount/scripting/NoSteamPlayerCount.sp index 28f87110..94d1310c 100644 --- a/NoSteamPlayerCount/scripting/NoSteamPlayerCount.sp +++ b/NoSteamPlayerCount/scripting/NoSteamPlayerCount.sp @@ -6,9 +6,11 @@ #pragma newdecls required bool g_bHasFakeClient[MAXPLAYERS + 1] = {false,...}; +int g_MaxPlayers = 64; -Handle g_hCVar_FakeClients = INVALID_HANDLE; -Handle g_hCVar_SourceTV = INVALID_HANDLE; +ConVar g_hCVar_FakeClients = INVALID_HANDLE; +ConVar g_hCVar_SourceTV = INVALID_HANDLE; +ConVar g_hCVar_MaxPlayers = INVALID_HANDLE; //---------------------------------------------------------------------------------------------------- // Purpose: @@ -27,7 +29,7 @@ public Plugin myinfo = //---------------------------------------------------------------------------------------------------- public void OnGameFrame() { - SteamWorks_SetMaxPlayers(65); + SteamWorks_SetMaxPlayers(g_MaxPlayers); } //---------------------------------------------------------------------------------------------------- @@ -37,6 +39,7 @@ 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); + g_hCVar_MaxPlayers = CreateConVar("sm_nosteamplayercount_maxplayers", "64", "Max Players to display in the sv browser", 0, true, 1.0, true, 128.0); AutoExecConfig(true, "plugin.NoSteamPlayerCount"); @@ -63,6 +66,15 @@ public void OnPluginEnd() } } +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue) +{ + if(convar == g_hCVar_MaxPlayers) + g_MaxPlayers = g_hCVar_MaxPlayers.IntValue; +} + //---------------------------------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------------------------------