Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions addons/sourcemod/scripting/CustomChatColors.sp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ char g_msgText[MAX_CHAT_LENGTH];
char g_msgFinal[255];
bool g_msgIsTeammate;

bool g_Ignored[(MAXPLAYERS + 1) * (MAXPLAYERS + 1)] = {false, ...};
bool g_Ignored[MAXPLAYERS + 1][MAXPLAYERS + 1];

int g_bSQLSelectReplaceRetry = 0;
int g_bSQLInsertReplaceRetry[MAXPLAYERS + 1] = { 0, ... };
Expand Down Expand Up @@ -164,7 +164,7 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
CreateNative("CCC_ResetColor", Native_ResetColor);
CreateNative("CCC_ResetTag", Native_ResetTag);

CreateNative("CCC_UpdateIgnoredArray", Native_UpdateIgnoredArray);
CreateNative("CCC_SetIgnored", Native_SetIgnored);
CreateNative("CCC_IsClientEnabled", Native_IsClientEnabled);

RegPluginLibrary("ccc");
Expand Down Expand Up @@ -4299,7 +4299,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][g_msgAuthor])
players[playersNum++] = client;
}
}
Expand All @@ -4310,7 +4310,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][g_msgAuthor])
players[playersNum++] = client;
}
}
Expand Down Expand Up @@ -4751,10 +4751,26 @@ public int Native_ResetTag(Handle plugin, int numParams)
return 1;
}

public int Native_UpdateIgnoredArray(Handle plugin, int numParams)
public int Native_SetIgnored(Handle plugin, int numParams)
{
GetNativeArray(1, g_Ignored, sizeof(g_Ignored));

int client = GetNativeCell(1);

if (!client || client > MaxClients)
{
ThrowNativeError(SP_ERROR_PARAM, "Invalid client or client is not in game");
return 0;
}

int target = GetNativeCell(2);

if (!target || target > MaxClients)
{
ThrowNativeError(SP_ERROR_PARAM, "Invalid target or target is not in game");
return 0;
}

bool value = view_as<bool>(GetNativeCell(3));
g_Ignored[client][target] = value;
return 1;
}

Expand Down
18 changes: 14 additions & 4 deletions addons/sourcemod/scripting/include/ccc.inc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#define CCC_V_MAJOR "7"
#define CCC_V_MINOR "4"
#define CCC_V_PATCH "21"
#define CCC_V_PATCH "22"

#define CCC_VERSION CCC_V_MAJOR..."."...CCC_V_MINOR..."."...CCC_V_PATCH

Expand Down Expand Up @@ -223,7 +223,17 @@ forward void CCC_OnUserConfigLoaded(int client);
*/
forward void CCC_OnConfigReloaded();

native int CCC_UpdateIgnoredArray(bool IgnoredArray[(MAXPLAYERS + 1) * (MAXPLAYERS + 1)]);
/**
* Sets Ignored value of a specific client to a specific target, this will ignore chat messages.
*
* @param client The client index
* @param target The target index
* @param ignored The ignorance value, true/false
* @noreturn
*
* On error/errors: Client or target is invalid
*/
native void CCC_SetIgnored(int client, int target, bool ignored);

public SharedPlugin __pl_ccc =
{
Expand All @@ -246,7 +256,7 @@ public __pl_ccc_SetNTVOptional() {
MarkNativeAsOptional("CCC_ResetTag");
MarkNativeAsOptional("CCC_ResetColor");
MarkNativeAsOptional("CCC_ResetTag");
MarkNativeAsOptional("CCC_UpdateIgnoredArray");
MarkNativeAsOptional("CCC_SetIgnored");
MarkNativeAsOptional("CCC_IsClientEnabled");
}
#endif
#endif