Merge branch 'master' of http://git.unloze.com/UNLOZE/sm-plugins-unloze
This commit is contained in:
commit
8e682153d9
@ -13,6 +13,9 @@ Handle g_hCookieHideLennies = null;
|
|||||||
bool g_bBlockCommands[MAXPLAYERS + 1] = { false, ... };
|
bool g_bBlockCommands[MAXPLAYERS + 1] = { false, ... };
|
||||||
Handle g_hCookieBlockCommands = null;
|
Handle g_hCookieBlockCommands = null;
|
||||||
|
|
||||||
|
bool g_bBlockChat[MAXPLAYERS + 1] = { false, ...};
|
||||||
|
Handle g_hCookieBlockChat = null;
|
||||||
|
|
||||||
#define NUMBEROFLENNIES 23
|
#define NUMBEROFLENNIES 23
|
||||||
|
|
||||||
char g_cLennies[NUMBEROFLENNIES][] = {"( ͡° ͜ʖ ͡°)", "͜ʖ", "(° ͜ʖ °)", "( ͝͠°͜ل͝͠°)", "( ͡° ͜ ͡°)", "( ͡°╭͜ʖ╮͡° )", "( ͠° ͜ʖ ͡°)", "( ° ͜ʖ °)", "(╯°□°)╯", "_(ツ)_", "_ツ_", "( ̿°̿ ͜ل͜ ̿°̿ )", "( ͡", "( ͠", "( ͝", "( °", "(͡", "ಠ_ಠ", "͡°", "°͡", "ʖ", "͡", "͜"};
|
char g_cLennies[NUMBEROFLENNIES][] = {"( ͡° ͜ʖ ͡°)", "͜ʖ", "(° ͜ʖ °)", "( ͝͠°͜ل͝͠°)", "( ͡° ͜ ͡°)", "( ͡°╭͜ʖ╮͡° )", "( ͠° ͜ʖ ͡°)", "( ° ͜ʖ °)", "(╯°□°)╯", "_(ツ)_", "_ツ_", "( ̿°̿ ͜ل͜ ̿°̿ )", "( ͡", "( ͠", "( ͝", "( °", "(͡", "ಠ_ಠ", "͡°", "°͡", "ʖ", "͡", "͜"};
|
||||||
@ -25,7 +28,7 @@ public Plugin myinfo =
|
|||||||
name = "ChatFilter",
|
name = "ChatFilter",
|
||||||
author = "Dogan",
|
author = "Dogan",
|
||||||
description = "Makes it possible to selfmute several things in chat",
|
description = "Makes it possible to selfmute several things in chat",
|
||||||
version = "2.0.0",
|
version = "2.1.0",
|
||||||
url = ""
|
url = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,6 +43,9 @@ public void OnPluginStart()
|
|||||||
RegConsoleCmd("sm_hide_commands", OnToggleCommands, "Toggle blocking Commands");
|
RegConsoleCmd("sm_hide_commands", OnToggleCommands, "Toggle blocking Commands");
|
||||||
g_hCookieBlockCommands = RegClientCookie("commands_blocked", "are commands blocked", CookieAccess_Protected);
|
g_hCookieBlockCommands = RegClientCookie("commands_blocked", "are commands blocked", CookieAccess_Protected);
|
||||||
|
|
||||||
|
RegConsoleCmd("sm_hide_chat", OnToggleChat, "Toggle blocking other players Messages");
|
||||||
|
g_hCookieBlockChat = RegClientCookie("chat_blocked", "are messages from others players blocked", CookieAccess_Protected);
|
||||||
|
|
||||||
SetCookieMenuItem(MenuHandler_CookieMenu, 0, "ChatFilter");
|
SetCookieMenuItem(MenuHandler_CookieMenu, 0, "ChatFilter");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,26 +64,35 @@ public Action OnToggleCommands(int client, int args)
|
|||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Action OnToggleChat(int client, int args)
|
||||||
|
{
|
||||||
|
ToggleChat(client);
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public void ShowSettingsMenu(int client)
|
public void ShowSettingsMenu(int client)
|
||||||
{
|
{
|
||||||
Menu menu = new Menu(MenuHandler_MainMenu);
|
Menu menu = new Menu(MenuHandler_MainMenu);
|
||||||
|
|
||||||
menu.SetTitle("ChatFilter Settings", client);
|
menu.SetTitle("ChatFilter Settings", client);
|
||||||
|
|
||||||
char sBuffer[128];
|
char sBuffer[128];
|
||||||
|
|
||||||
Format(sBuffer, sizeof(sBuffer), "Hiding Lennies: %s", g_bHideLennies[client] ? "Enabled" : "Disabled");
|
Format(sBuffer, sizeof(sBuffer), "Hiding Lennies: %s", g_bHideLennies[client] ? "Enabled" : "Disabled");
|
||||||
menu.AddItem("0", sBuffer);
|
menu.AddItem("0", sBuffer);
|
||||||
|
|
||||||
Format(sBuffer, sizeof(sBuffer), "Hiding Commands: %s", g_bBlockCommands[client] ? "Enabled" : "Disabled");
|
Format(sBuffer, sizeof(sBuffer), "Hiding Commands: %s", g_bBlockCommands[client] ? "Enabled" : "Disabled");
|
||||||
menu.AddItem("1", sBuffer);
|
menu.AddItem("1", sBuffer);
|
||||||
|
|
||||||
menu.ExitBackButton = true;
|
Format(sBuffer, sizeof(sBuffer), "Hiding all Messages: %s", g_bBlockChat[client] ? "Enabled" : "Disabled");
|
||||||
|
menu.AddItem("2", sBuffer);
|
||||||
|
|
||||||
menu.Display(client, MENU_TIME_FOREVER);
|
menu.ExitBackButton = true;
|
||||||
|
|
||||||
|
menu.Display(client, MENU_TIME_FOREVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -111,6 +126,7 @@ public int MenuHandler_MainMenu(Menu menu, MenuAction action, int client, int se
|
|||||||
{
|
{
|
||||||
case(0): ToggleLennies(client);
|
case(0): ToggleLennies(client);
|
||||||
case(1): ToggleCommands(client);
|
case(1): ToggleCommands(client);
|
||||||
|
case(2): ToggleChat(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowSettingsMenu(client);
|
ShowSettingsMenu(client);
|
||||||
@ -132,14 +148,19 @@ 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;
|
||||||
|
|
||||||
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) || (g_bBlockCommands[client] && (index == 0 || index == 7)))
|
if(g_bHideLennies[client] && StrContains(message, g_cLennies[i], false) != -1)
|
||||||
{
|
{
|
||||||
return Plugin_Handled;
|
lennies = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(lennies == 1 || (g_bBlockCommands[client] && (index == 0 || index == 7)) || g_bBlockChat[client])
|
||||||
|
return Plugin_Handled;
|
||||||
|
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,6 +183,14 @@ public void ToggleCommands(int client)
|
|||||||
CPrintToChat(client, "{cyan}[ChatFilter] {white}%s", g_bBlockCommands[client] ? "Commands are now hidden." : "Commands are not hidden anymore.");
|
CPrintToChat(client, "{cyan}[ChatFilter] {white}%s", g_bBlockCommands[client] ? "Commands are now hidden." : "Commands are not hidden anymore.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ToggleChat(int client)
|
||||||
|
{
|
||||||
|
g_bBlockChat[client] = !g_bBlockChat[client];
|
||||||
|
|
||||||
|
SetClientCookie(client, g_hCookieBlockChat, g_bBlockChat[client] ? "1" : "");
|
||||||
|
CPrintToChat(client, "{cyan}[ChatFilter] {white}%s", g_bBlockChat[client] ? "Messages from all Players are now hidden." : "Messages from all Players are not hidden anymore.");
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -188,6 +217,16 @@ public void OnClientCookiesCached(int client)
|
|||||||
{
|
{
|
||||||
g_bBlockCommands[client] = false;
|
g_bBlockCommands[client] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GetClientCookie(client, g_hCookieBlockChat, sBuffer, sizeof(sBuffer));
|
||||||
|
if(sBuffer[0] != '\0')
|
||||||
|
{
|
||||||
|
g_bBlockChat[client] = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_bBlockChat[client] = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -197,4 +236,5 @@ public void OnClientDisconnect(int client)
|
|||||||
{
|
{
|
||||||
g_bHideLennies[client] = false;
|
g_bHideLennies[client] = false;
|
||||||
g_bBlockCommands[client] = false;
|
g_bBlockCommands[client] = false;
|
||||||
|
g_bBlockChat[client] = false;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user