My goal is to give a tag next to the nickname of top 50 players, but when players with a tag, for example, admin, mod, owner or vip players write something in the chat, it says double. how can i prevent this? I need to make sure it has both tags. Also "@ and /" appear in the conversation when I use these symbols. When I type in team chat, it also appears in global chat.
Errors
Quote:
1.If a Player has a hashtag it drops as a double message to the chat.(Owner,Admin,Mod or Vip)
2.When she writes to Team Chat, it also texts the global chat.
3-The rank should only appear in the Global chat, while it only appears in the Team chat. I could not prevent this.
|
What I am trying to do is when a player posts a message to the global chat.
This normal player
[RANK-3]
Nickname
This is the player with a Tag too.
Owner
[RANK-3]
[O]Nickname
VIP
[RANK-3]
[V]Nickname
ADMIN
[RANK-3]
[A]Nickname
MOD
[RANK-3]
[M]Nickname
Rank will not appear if he writes to Team Chat. If this player does not have a tag, he will write in color when writing in the team chat.
PHP Code:
public Action cmd_Say(int client, int args)
{
char Text[255];
char Name[MAX_NAME_LENGTH];
//char Command[64];
int Start = 0;
GetCmdArgString(Text, sizeof(Text));
int TextLen = strlen(Text);
// This apparently happens sometimes?
if (TextLen <= 0) {
return Plugin_Continue;
}
if (Text[TextLen - 1] == '"') {
Text[TextLen - 1] = '\0';
Start = 1;
}
if (ClientRank[client] > 0)
{
if( ClientRank[client] > 0 && ClientRank[client] <= 50 )
{
GetClientName(client, Name, sizeof(Name));
GetCmdArgString(Text, sizeof(Text));
Text[strlen(Text)-1] = '\0';
PrintToChatAll("\x04[\x01\x03RANK-%i\x01\x04]\x01\x05%s:", ClientRank[client], Name);
}
}
This is the Plugin I Tag Players.
PHP Code:
public Action OnPlayerChatCheck(int client, const char[] command, int args)
{
if (client == 0 || args == 0)
{
return Plugin_Continue;
}
if (!IsClientInGame(client))
{
return Plugin_Handled;
}
char sChatText[384];
GetCmdArgString(sChatText, sizeof(sChatText));
StripQuotes(sChatText);
if ((GetUserFlagBits(client) & ADMFLAG_ROOT))
{
if (sChatText[0] == '/')
{
return Plugin_Handled;
}
PrintToChatAll("\x04[OWNER] \x05%N\x01: %s", client, sChatText);
return Plugin_Handled;
}
If he writes in team chat
PHP Code:
public Action OnPlayerTeamChatCheck(int client, const char[] command, int args)
{
if(client == 0 || args == 0)
{
return Plugin_Continue;
}
if (!IsClientInGame(client))
{
return Plugin_Handled;
}
char sChatText[384];
GetCmdArgString(sChatText, sizeof(sChatText));
StripQuotes(sChatText);
if ((GetUserFlagBits(client) & ADMFLAG_ROOT))
{
if (sChatText[0] == '/')
{
return Plugin_Handled;
}
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i) || GetClientTeam(i) != GetClientTeam(client) || IsFakeClient(i))
{
continue;
}
PrintToChat(i, "\x03%s \x04[O]\x05 %N\x01: %s", (GetClientTeam(client) != 2) ? ((GetClientTeam(client) == 3) ? "(Infected)" : "(Spectators)") : "(Survivors)", client, sChatText)
}
return Plugin_Handled;
}