NoSteamPlayerCount: added cvars + cfg file to determine how to deal with fake clients and sourcetv

This commit is contained in:
neon 2018-08-29 14:38:31 +02:00
parent 9d1c5539e7
commit 7854557480

View File

@ -7,6 +7,9 @@
bool g_bHasFakeClient[MAXPLAYERS + 1] = {false,...}; bool g_bHasFakeClient[MAXPLAYERS + 1] = {false,...};
Handle g_hCVar_FakeClients = INVALID_HANDLE;
Handle g_hCVar_SourceTV = INVALID_HANDLE;
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
@ -32,6 +35,11 @@ public void OnGameFrame()
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public void OnPluginStart() 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_addfake", Command_AddFake, ADMFLAG_ROOT, "");
RegAdminCmd("sm_removefake", Command_RemoveFake, ADMFLAG_ROOT, ""); RegAdminCmd("sm_removefake", Command_RemoveFake, ADMFLAG_ROOT, "");
RegAdminCmd("sm_countfakes", Command_CountFakes, ADMFLAG_BAN, ""); 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) 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]; char sSteamID[32];
GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID)); GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID));