ChatColors: Add a message forward.

Allows to block message per client.
This commit is contained in:
zaCade
2018-06-14 16:21:36 +02:00
parent 0e4b21116b
commit ded4308733
2 changed files with 23 additions and 7 deletions
@@ -24,7 +24,7 @@ public Plugin myinfo =
//Handle nameForward;
//Handle tagForward;
//Handle applicationForward;
//Handle messageForward;
Handle messageForward;
Handle preLoadedForward;
Handle loadedForward;
Handle configReloadedForward;
@@ -145,7 +145,7 @@ public void OnPluginStart()
//nameForward = CreateGlobalForward("CCC_OnNameColor", ET_Event, Param_Cell);
//tagForward = CreateGlobalForward("CCC_OnTagApplied", ET_Event, Param_Cell);
//applicationForward = CreateGlobalForward("CCC_OnColor", ET_Event, Param_Cell, Param_String, Param_Cell);
//messageForward = CreateGlobalForward("CCC_OnChatMessage", ET_Ignore, Param_Cell, Param_String, Param_Cell);
messageForward = CreateGlobalForward("CCC_OnChatMessage", ET_Ignore, Param_Cell, Param_Cell, Param_String);
preLoadedForward = CreateGlobalForward("CCC_OnUserConfigPreLoaded", ET_Event, Param_Cell);
loadedForward = CreateGlobalForward("CCC_OnUserConfigLoaded", ET_Ignore, Param_Cell);
configReloadedForward = CreateGlobalForward("CCC_OnConfigReloaded", ET_Ignore);
@@ -2707,7 +2707,7 @@ public Action Event_PlayerSay(Handle event, const char[] name, bool dontBroadcas
{
if (IsClientInGame(client) && GetClientTeam(client) == team)
{
if(!g_Ignored[client * (MAXPLAYERS + 1) + g_msgAuthor])
if(!g_Ignored[client * (MAXPLAYERS + 1) + g_msgAuthor] || MessageForward(client, g_msgAuthor, g_msgText))
players[playersNum++] = client;
}
}
@@ -2718,7 +2718,7 @@ public Action Event_PlayerSay(Handle event, const char[] name, bool dontBroadcas
{
if (IsClientInGame(client))
{
if(!g_Ignored[client * (MAXPLAYERS + 1) + g_msgAuthor])
if(!g_Ignored[client * (MAXPLAYERS + 1) + g_msgAuthor] || MessageForward(client, g_msgAuthor, g_msgText))
players[playersNum++] = client;
}
}
@@ -2839,6 +2839,22 @@ stock bool ConfigForward(int client)
return true;
}
stock bool MessageForward(int client, int author, char[] message)
{
Action result = Plugin_Continue;
Call_StartForward(messageForward);
Call_PushCell(client);
Call_PushCell(author);
Call_PushString(message);
Call_Finish(result);
if (result >= Plugin_Handled)
return false;
return true;
}
public int Native_GetColor(Handle plugin, int numParams)
{
int client = GetNativeCell(1);