Browse Source

Respect player mute selections

Prevent transmission to players that muted the message author.
nosoop 7 years ago
parent
commit
48e7a34b94
1 changed files with 9 additions and 2 deletions
  1. 9 2
      scripting/simple-chatprocessor.sp

+ 9 - 2
scripting/simple-chatprocessor.sp

@@ -9,10 +9,11 @@
 #include <sourcemod>
 
 #include <sdkhooks>
+#include <sdktools_voice>
 
 #pragma newdecls required
 
-#define PLUGIN_VERSION "0.1.1"
+#define PLUGIN_VERSION "0.1.2"
 public Plugin myinfo = {
 	name = "[CSRD] Simple Chat Processor",
 	author = "nosoop (based off of Simple Plugins' implementation)",
@@ -177,7 +178,13 @@ public void OnClientThinkPost(int author) {
 				// convert ArrayList to client array
 				int clients[MAXPLAYERS + 1], nClients;
 				for (int i = 0; i < clientList.Length; i++) {
-					clients[nClients++] = clientList.Get(i);
+					int recipient = clientList.Get(i);
+					
+					// display to author and players that did not mute the author
+					if (recipient == author
+							|| !IsClientMuted(recipient, author)) {
+						clients[nClients++] = recipient;
+					}
 				}
 				
 				SayText(author, clients, nClients, localizationToken, name, message);