Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
64 changes: 37 additions & 27 deletions addons/sourcemod/scripting/CustomChatColors.sp
Original file line number Diff line number Diff line change
Expand Up @@ -1820,16 +1820,44 @@ void SendPrivateChat(int client, int target, const char[] message)
ShowSettingsMenu(client);
return;
}

if (client && (IsClientInGame(client) && BaseComm_IsClientGagged(client)))
{
CPrintToChat(client, "{green}[SM]{default} You are {red}not allowed {default}to use this command {red}since you are gagged{default}.");
return;
}

#if defined _sourcecomms_included
if (g_bSourceCommsNative && client)
{
int IsGagged = SourceComms_GetClientGagType(client);
if (IsGagged > 0)
{
CPrintToChat(client, "{green}[SM]{default} You are {red}not allowed {default}to use this command {red}since you are gagged{default}.");
return;
}
}
#endif

int iTime = GetTime();
if (g_iClientPsayCooldown[client] > iTime)
{
CPrintToChat(client, "{green}[SM]{default} You are on cooldown, wait {olive}%d {default}seconds to use this command again.", (g_iClientPsayCooldown[client] - iTime));
return;
}

if (!target || !IsClientInGame(target))
{
CPrintToChat(client, "{green}[SM]{default} The receiver is not in the game.");
return;
}

if (g_bDisablePsay[target])
{
CPrintToChat(client, "{green}[SM]{olive} %N{default} has{red} disabled{default} private messages.", target);
return;
}

char text[192];
Format(text, sizeof(text), "%s", message);
StripQuotes(text);
Expand Down Expand Up @@ -1895,7 +1923,7 @@ void SendPrivateChat(int client, int target, const char[] message)
g_sSmChatColor, text);
#endif

g_iClientPsayCooldown[client] = GetTime() + g_cvPsayCooldown.IntValue;
g_iClientPsayCooldown[client] = iTime + g_cvPsayCooldown.IntValue;
CPrintToChat(target, "{green}[SM] {default}Use /r <message> to reply.");
LogAction(client, target, "\"%L\" triggered sm_psay to \"%L\" (text %s)", client, target, text);
}
Expand Down Expand Up @@ -2194,27 +2222,6 @@ public Action Command_SmChat(int client, int args)

public Action Command_SmPsay(int client, int args)
{
if (client && (IsClientInGame(client) && BaseComm_IsClientGagged(client)))
return Plugin_Continue;

#if defined _sourcecomms_included
if (g_bSourceCommsNative && client)
{
int IsGagged = SourceComms_GetClientGagType(client);
if(IsGagged > 0)
{
CReplyToCommand(client, "{green}[SM] {default}You are {red}not allowed {default}to use this command {red}since you are gagged{default}.");
return Plugin_Handled;
}
}
#endif

if(g_iClientPsayCooldown[client] > GetTime())
{
CReplyToCommand(client, "{green}[SM] {default}You are on cooldown, wait {olive}%d {default}seconds to use this command again.", (g_iClientPsayCooldown[client] - GetTime()));
return Plugin_Handled;
}

if (args < 2)
{
CReplyToCommand(client, "{green}[SM] {default}Usage: sm_psay <name or #userid> <message>");
Expand All @@ -2226,14 +2233,17 @@ public Action Command_SmPsay(int client, int args)

int len = BreakString(text, arg, sizeof(arg));

int target = FindTarget(client, arg, true, false);
// We don't allow multi-target filters
if (arg[0] == '@')
ReplaceString(arg, sizeof(arg), "@", "");

int target = FindTarget(client, arg, true, false);
if (target == -1)
return Plugin_Handled;

SendPrivateChat(client, target, text[len]);
g_iClientFastReply[target] = client;
g_iClientFastReply[client] = target;
g_iClientFastReply[target] = GetClientUserId(client);
g_iClientFastReply[client] = GetClientUserId(target);

return Plugin_Stop;
}
Expand Down Expand Up @@ -2266,7 +2276,7 @@ public Action Command_SmPsayReply(int client, int args)
Format(message, sizeof(message), "%s %s", message, arg);
}

int target = g_iClientFastReply[client];
int target = GetClientOfUserId(g_iClientFastReply[client]);
if (target == -1)
return Plugin_Handled;

Expand Down Expand Up @@ -4570,4 +4580,4 @@ public int Native_IsClientEnabled(Handle plugin, int numParams)
{
int client = GetNativeCell(1);
return (HasFlag(client, Admin_Generic) || HasFlag(client, Admin_Custom1)) && g_iClientEnable[client];
}
}
2 changes: 1 addition & 1 deletion 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 "15"
#define CCC_V_PATCH "16"

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

Expand Down