ChatFilter: use bools and add one lenny

This commit is contained in:
Dogan 2019-11-03 23:02:12 +01:00
parent d5d94de662
commit 8b2441866b

View File

@ -16,9 +16,9 @@ Handle g_hCookieBlockCommands = null;
bool g_bBlockChat[MAXPLAYERS + 1] = { false, ...}; bool g_bBlockChat[MAXPLAYERS + 1] = { false, ...};
Handle g_hCookieBlockChat = null; Handle g_hCookieBlockChat = null;
#define NUMBEROFLENNIES 23 #define NUMBEROFLENNIES 24
char g_cLennies[NUMBEROFLENNIES][] = {"( ͡° ͜ʖ ͡°)", "͜ʖ", "(° ͜ʖ °)", "( ͝͠°͜ل͝͠°)", "( ͡° ͜ ͡°)", "( ͡°╭͜ʖ╮͡° )", "( ͠° ͜ʖ ͡°)", "( ° ͜ʖ °)", "(╯°□°)╯", "_(ツ)_", "_ツ_", "( ̿°̿ ͜ل͜ ̿°̿ )", "( ͡", "( ͠", "( ͝", "( °", "", "ಠ_ಠ", "͡°", "°͡", "ʖ", "͡", "͜"}; char g_cLennies[NUMBEROFLENNIES][] = {"( ͡° ͜ʖ ͡°)", "͜ʖ", "(° ͜ʖ °)", "( ͝͠°͜ل͝͠°)", "( ͡° ͜ ͡°)", "( ͡°╭͜ʖ╮͡° )", "( ͠° ͜ʖ ͡°)", "( ° ͜ʖ °)", "(╯°□°)╯", "_(ツ)_", "_ツ_", "( ̿°̿ ͜ل͜ ̿°̿ )", "( ͡", "( ͠", "( ͝", "( °", "", "ಠ_ಠ", "͡°", "°͡", "ʖ", "͡", "͜", ""};
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
@ -157,17 +157,17 @@ public int MenuHandler_MainMenu(Menu menu, MenuAction action, int client, int se
public Action CCC_OnChatMessage(int client, int author, const char[] message) public Action CCC_OnChatMessage(int client, int author, const char[] message)
{ {
int index = FindCharInString(message, '!', false); int index = FindCharInString(message, '!', false);
int lennies = 0; bool blennies = false;
for(int i = 0; i < NUMBEROFLENNIES; i++) for(int i = 0; i < NUMBEROFLENNIES; i++)
{ {
if(g_bHideLennies[client] && StrContains(message, g_cLennies[i], false) != -1) if(g_bHideLennies[client] && StrContains(message, g_cLennies[i], false) != -1)
{ {
lennies = 1; blennies = true;
} }
} }
if(lennies == 1 || (g_bBlockCommands[client] && (index == 0 || index == 7)) || g_bBlockChat[client]) if(blennies || (g_bBlockCommands[client] && (index == 0 || index == 7)) || g_bBlockChat[client])
return Plugin_Handled; return Plugin_Handled;
return Plugin_Continue; return Plugin_Continue;