Browse Source

Minor function tweaks.

Just renamed `GetChatMessageFlags` to `ParseChatMessageFlags` (since we
are parsing the localiztion string from SayText2), and stopped caring
about `bChat`.
nosoop 8 năm trước cách đây
mục cha
commit
f719fa7cc1
1 tập tin đã thay đổi với 5 bổ sung5 xóa
  1. 5 5
      scripting/simple-chatprocessor.sp

+ 5 - 5
scripting/simple-chatprocessor.sp

@@ -12,7 +12,7 @@
 
 #pragma newdecls required
 
-#define PLUGIN_VERSION "0.0.0"
+#define PLUGIN_VERSION "0.1.0"
 public Plugin myinfo = {
 	name = "[CSRD] Simple Chat Processor",
 	author = "nosoop (based off of Simple Plugins' implementation)",
@@ -100,7 +100,7 @@ public Action OnSayText2(UserMsg id, Handle buffer, const int[] clients, int nCl
 		return Plugin_Continue;
 	}
 	
-	bool bChat = bitbuf.ReadByte() != 0;
+	bitbuf.ReadByte(); // bChat, unused?
 	
 	char localizationToken[32];
 	bitbuf.ReadString(localizationToken, sizeof(localizationToken));
@@ -109,7 +109,7 @@ public Action OnSayText2(UserMsg id, Handle buffer, const int[] clients, int nCl
 		return Plugin_Continue;
 	}
 	
-	if (!GetChatMessageFlags(localizationToken)) {
+	if (!ParseChatMessageFlags(localizationToken)) {
 		return Plugin_Continue;
 	}
 	
@@ -166,7 +166,7 @@ public void OnClientThinkPost(int client) {
 			GetClientName(client, name, sizeof(name));
 			
 			// Prepare chat message flags.
-			g_ChatFlags = GetChatMessageFlags(localizationToken);
+			g_ChatFlags = ParseChatMessageFlags(localizationToken);
 			
 			// Forward call.
 			Action forwardResult = ForwardOnChatMessage(client, clientList, name, sizeof(name),
@@ -232,7 +232,7 @@ public int Native_GetMessageFlags(Handle hPlugin, int argc) {
 	return g_ChatFlags;
 }
 
-int GetChatMessageFlags(const char[] localizationToken) {
+int ParseChatMessageFlags(const char[] localizationToken) {
 	int chatFlags;
 	if (StrContains(localizationToken, "all", false) != -1) {
 		// send to all players, living and dead