From b6a6387f16a8df9d2c0bd0fa3c2faf0c9c06d0e7 Mon Sep 17 00:00:00 2001
From: sneak-it <16104273+sneak-it@users.noreply.github.com>
Date: Fri, 7 Feb 2020 01:32:16 -0500
Subject: [PATCH] Prevent basecommands from printing to disconnected clients
 (#1138)

---
 plugins/basecommands.sp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/plugins/basecommands.sp b/plugins/basecommands.sp
index 911ebdf3..c34bbe9e 100644
--- a/plugins/basecommands.sp
+++ b/plugins/basecommands.sp
@@ -395,10 +395,15 @@ public Action Command_Rcon(int client, int args)
 	if (client == 0) // They will already see the response in the console.
 	{
 		ServerCommand("%s", argstring);
-	} else {
+	}
+	else
+	{
 		char responseBuffer[4096];
 		ServerCommandEx(responseBuffer, sizeof(responseBuffer), "%s", argstring);
-		ReplyToCommand(client, responseBuffer);
+		if (IsClientConnected(client))
+		{
+			ReplyToCommand(client, responseBuffer);
+		}
 	}
 
 	return Plugin_Handled;