public Action ChatSay(int client, const char[] command, int args)
{
if(GetConVarInt(g_hChatTag))
{
if (IsValidClient(client))
{
/* Flood Protection */
if ((GetEngineTime()-g_fLastChatMsg[client]) < 0.75)
{
return Plugin_Handled;
}
g_fLastChatMsg[client] = GetEngineTime();
if (BaseComm_IsClientGagged(client))
{
PrintToChat(client, "%t", "MUTE");
return Plugin_Handled;
}
char text[192];
GetCmdArgString(text, sizeof(text));
StripQuotes(text);
TrimString(text);
if (strcmp(text, " ") == 0 || strcmp(text, "") == 0 || strlen(text) == 0)
{
return Plugin_Handled;
}
if (StrContains(text, "@") == 0 || StrContains(text, "/") == 0)
{
return Plugin_Continue;
}
int team = GetClientTeam(client);
int alive = IsPlayerAlive(client);
char ip[16], tag[3];
GetClientIP(client, ip, sizeof(ip));
if (!GeoipCode2(ip, tag))
{
tag = "??";
}
if (strcmp(command, "say") == 0)
{
CPrintToChatAllEx(client, "%t", team < 2 ? "SPECTATOR_SAY_TEAM":alive ? "ALIVE_CHAT":"DEAD", tag, client, text);
return Plugin_Handled;
}
else if(strcmp(command, "say_team") == 0)
{
char buffer[256];
switch(team)
{
case 2:FormatEx(buffer, sizeof(buffer), "%T", alive ? "TEAM_T":"DEAD_TEAM_T", client, tag, client, text);
case 3:FormatEx(buffer, sizeof(buffer), "%T", alive ? "TEAM_CT":"DEAD_TEAM_CT", client, tag, client, text);
default:FormatEx(buffer, sizeof(buffer),"%T", "SPECTATOR_SAY", client, tag, client, text);
}
for (int x = 1; x <= MaxClients; x++)
{
if (IsClientInGame(x) && GetClientTeam(x) == team)
{
CPrintToChatEx(x, x, buffer);
}
}
return Plugin_Handled;
}
}
}
return Plugin_Continue;
}