From 3cb6aca0a8ada47f81c8d09e6e48374349cbcc35 Mon Sep 17 00:00:00 2001
From: Dogan <gfldogan@gmail.com>
Date: Fri, 4 Oct 2019 13:50:30 +0200
Subject: [PATCH] FakePopulation: general improvement

+ add sm_fakes
---
 FakePopulation/scripting/FakePopulation.sp | 47 ++++++++++++++++++----
 1 file changed, 40 insertions(+), 7 deletions(-)

diff --git a/FakePopulation/scripting/FakePopulation.sp b/FakePopulation/scripting/FakePopulation.sp
index d0fbc941..fa74b1d1 100644
--- a/FakePopulation/scripting/FakePopulation.sp
+++ b/FakePopulation/scripting/FakePopulation.sp
@@ -22,9 +22,9 @@ int g_iUserInfoStringTable;
 public Plugin myinfo =
 {
 	name        = "ImprovedHitboxes", //camouflage
-	author      = "Neon + Dogan",
+	author      = "Neon + Dogan + Botox",
 	description = "Handle Hitboxes via Plugin",
-	version     = "3.1",
+	version     = "4.0",
 	url         = "https://steamcommunity.com/id/n3ontm"
 };
 
@@ -33,12 +33,13 @@ public Plugin myinfo =
 //----------------------------------------------------------------------------------------------------
 public void OnPluginStart()
 {
-	RegAdminCmd("sm_debugfakes", Command_DebugFakes, ADMFLAG_RCON, "");
-	RegAdminCmd("sm_setfakes", Command_SetFakes, ADMFLAG_RCON, "");
+	RegAdminCmd("sm_debugfakes", Command_DebugFakes, ADMFLAG_RCON, "Shows the amount of fake-clients on server");
+	RegAdminCmd("sm_setfakes", Command_SetFakes, ADMFLAG_RCON, "Manually sets the amount of fake-clients");
+	RegAdminCmd("sm_fakes", Command_Fakes, ADMFLAG_RCON, "Shows the fake-clients on server");
 
 	g_iAdminFakes = -1;
 	g_bMapEnded = false;
-	CreateTimer(1.0, RandomizePing, _, TIMER_REPEAT);
+	CreateTimer(3.0, RandomizePing, _, TIMER_REPEAT);
 
 	RequestFrame(CheckPopulation);
 
@@ -107,7 +108,7 @@ public Action Command_DebugFakes(int client, int argc)
 			iFakesInTeam++;
 	}
 
-	ReplyToCommand(client, "[SM] There are currently %d Fake Players, from which %d are in Spectate.", iFakes, iFakes - iFakesInTeam);
+	ReplyToCommand(client, "[SM] There are currently %d Fake-Clients, from which %d are in Spectate.", iFakes, iFakes - iFakesInTeam);
 
 	return Plugin_Handled;
 }
@@ -132,11 +133,43 @@ public Action Command_SetFakes(int client, int argc)
 		return Plugin_Handled;
 	}
 
-	ReplyToCommand(client, "[SM] You set the amount of Fake Players to %d.", g_iAdminFakes);
+	ReplyToCommand(client, "[SM] You set the amount of Fake-Clients to %d.", g_iAdminFakes);
 	CheckPopulation();
 	return Plugin_Handled;
 }
 
+//----------------------------------------------------------------------------------------------------
+// Purpose:
+//----------------------------------------------------------------------------------------------------
+public Action Command_Fakes(int client, int args)
+{
+	char aBuf[1024];
+	char aBuf2[MAX_NAME_LENGTH];
+
+	for(int i = 1; i <= MaxClients; i++)
+	{
+		if(IsClientInGame(i))
+		{
+			if(g_bFakePopulation[i])
+			{
+				GetClientName(i, aBuf2, sizeof(aBuf2));
+				StrCat(aBuf, sizeof(aBuf), aBuf2);
+				StrCat(aBuf, sizeof(aBuf), ", ");
+			}
+		}
+	}
+
+	if(strlen(aBuf))
+	{
+		aBuf[strlen(aBuf) - 2] = 0;
+		ReplyToCommand(client, "[SM] Fake-Clients online: %s", aBuf);
+	}
+	else
+		ReplyToCommand(client, "[SM] Fake-Clients online: none");
+
+	return Plugin_Handled;
+}
+
 //----------------------------------------------------------------------------------------------------
 // Purpose:
 //----------------------------------------------------------------------------------------------------