Browse Source

Send messages to players individually

nosoop 2 years ago
parent
commit
4efaf81f81
1 changed files with 18 additions and 13 deletions
  1. 18 13
      scripting/simple-chatprocessor.sp

+ 18 - 13
scripting/simple-chatprocessor.sp

@@ -12,7 +12,7 @@
 
 #pragma newdecls required
 
-#define PLUGIN_VERSION "0.2.1"
+#define PLUGIN_VERSION "0.3.0"
 public Plugin myinfo = {
 	name = "[CSRD] Simple Chat Processor",
 	author = "nosoop (based off of Simple Plugins' implementation)",
@@ -280,16 +280,21 @@ int ParseChatMessageFlags(const char[] localizationToken) {
 
 void SayText(int author, int[] clients, int nClients,
 		const char[] localizationToken, const char[] name, const char[] message) {
-	Handle buffer = StartMessage("SayText2", clients, nClients,
-			USERMSG_RELIABLE | USERMSG_BLOCKHOOKS);
-	
-	BfWrite bitbuf = view_as<BfWrite>(buffer);
-	
-	bitbuf.WriteByte(author);
-	bitbuf.WriteByte(true);
-	bitbuf.WriteString(localizationToken);
-	bitbuf.WriteString(name);
-	bitbuf.WriteString(message);
-	
-	EndMessage();
+	for (int i; i < nClients; i++) {
+		int temp[1];
+		temp[0] = clients[i];
+		
+		Handle buffer = StartMessage("SayText2", temp, 1,
+				USERMSG_RELIABLE | USERMSG_BLOCKHOOKS);
+		
+		BfWrite bitbuf = view_as<BfWrite>(buffer);
+		
+		bitbuf.WriteByte(author);
+		bitbuf.WriteByte(true);
+		bitbuf.WriteString(localizationToken);
+		bitbuf.WriteString(name);
+		bitbuf.WriteString(message);
+		
+		EndMessage();
+	}
 }