ChatColors: Add a message forward.
Allows to block message per client.
This commit is contained in:
parent
0e4b21116b
commit
ded4308733
@ -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);
|
||||
|
@ -134,12 +134,12 @@ native int CCC_ResetTag(int client);
|
||||
/**
|
||||
* Called when a message has been fully colored and will be sent, unless further plugins modify it through Simple Chat Processor
|
||||
*
|
||||
* @param client Recieving client index
|
||||
* @param author Author client index
|
||||
* @param message Message
|
||||
* @param maxlen Maximum length of message buffer
|
||||
* @noreturn
|
||||
* @return Plugin_Handled to block message, Plugin_Continue to allow message
|
||||
*/
|
||||
//forward CCC_OnChatMessage(author, String:message[], maxlen);
|
||||
forward Action CCC_OnChatMessage(int client, int author, const char[] message);
|
||||
|
||||
/**
|
||||
* Called when a client's colors and tag are about to be loaded from the config file
|
||||
|
Loading…
Reference in New Issue
Block a user