#pragma semicolon 1 #include #include #include #include #include #include #include bool g_bHideLennies[MAXPLAYERS + 1] = { false, ... }; bool g_bHideLenniesHooked = false; Handle g_hCookieHideLennies = null; char g_cLennies[23][] = {"( ͡° ͜ʖ ͡°)", "͜ʖ", "(° ͜ʖ °)", "( ͝͠°͜ل͝͠°)", "( ͡° ͜ ͡°)", "( ͡°╭͜ʖ╮͡° )", "( ͠° ͜ʖ ͡°)", "( ° ͜ʖ °)", "(╯°□°)╯", "_(ツ)_", "_ツ_", "( ̿°̿ ͜ل͜ ̿°̿ )", "( ͡", "( ͠", "( ͝", "( °", "(͡", "ಠ_ಠ", "͡°", "°͡", "ʖ", "͡", "͜"}; public Plugin myinfo = { name = "AntiLenny", author = "Dogan", description = "Makes it possible to selfmute Lennies", version = "1.2.0", url = "" } public void OnPluginStart() { RegConsoleCmd("sm_hide_lennies", HideLennies, "Toggle blocking Lennies"); g_hCookieHideLennies = RegClientCookie("lennies_blocked", "are lennies blocked", CookieAccess_Protected); } public Action CCC_OnChatMessage(int client, int author, const char[] message) { for(int i = 0; i < 23; i++) { if(g_bHideLennies[client] && StrContains(message, g_cLennies[i], false) != -1) { return Plugin_Handled; } } return Plugin_Continue; } public Action HideLennies(int client, int args) { g_bHideLennies[client] = !g_bHideLennies[client]; CheckHideLenniesHooks(); if(g_bHideLennies[client]) { ReplyToCommand(client, "You blocked Lennies"); SetClientCookie(client, g_hCookieHideLennies, "1"); } else { ReplyToCommand(client, "You unblocked Lennies"); SetClientCookie(client, g_hCookieHideLennies, ""); } return Plugin_Handled; } public void OnClientCookiesCached(int client) { char sBuffer[2]; GetClientCookie(client, g_hCookieHideLennies, sBuffer, sizeof(sBuffer)); if(sBuffer[0] != '\0') { g_bHideLennies[client] = true; g_bHideLenniesHooked = true; } else { g_bHideLennies[client] = false; } } public void OnClientDisconnect(int client) { g_bHideLennies[client] = false; CheckHideLenniesHooks(); } public void CheckHideLenniesHooks() { bool bShouldHook = false; for(int i = 1; i <= MaxClients; i++) { if(g_bHideLennies[i]) { bShouldHook = true; break; } } g_bHideLenniesHooked = bShouldHook; }