05.06.2012, 11:45
Hello,i've done this code for the team chat:
It's OnPlayerText.
I've 2 problems.
The first,when i do like ;test - It sends the message in the normal chat and in the team chat,so double messages.
The second,every team can see the team chat.Ex: If i'm team japan,i can see russia team chat,usa team chat and so on,same with other teams.
What's wrong?
pawn Код:
if(text[0] == ';')
{
new nameee[24];
new string[256];
GetPlayerName(playerid,nameee,sizeof nameee);
if( gTeam[playerid] == TEAM_USA)
{
GetPlayerName(playerid,nameee,sizeof(nameee));
format(string,sizeof(string),"Usa Team Chat: [%i](%s): %s",playerid,nameee,text[1]);
SendClientMessageToAll(COLOR_LIGHTRED, string);
TeamChatLog(string);
}
if( gTeam[playerid] == TEAM_GERMANY)
{
GetPlayerName(playerid,nameee,sizeof(nameee));
format(string,sizeof(string),"Germany Team Chat: [%i](%s): %s",playerid,nameee,text[1]);
SendClientMessageToAll(COLOR_LIGHTRED, string);
TeamChatLog(string);
}
if( gTeam[playerid] == TEAM_RUSSIA)
{
GetPlayerName(playerid,nameee,sizeof(nameee));
format(string,sizeof(string),"Russia Team Chat: [%i](%s): %s",playerid,nameee,text[1]);
SendClientMessageToAll(COLOR_LIGHTRED, string);
TeamChatLog(string);
}
if( gTeam[playerid] == TEAM_JAPAN)
{
GetPlayerName(playerid,nameee,sizeof(nameee));
format(string,sizeof(string),"Japan Team Chat: [%i](%s): %s",playerid,nameee,text[1]);
SendClientMessageToAll(COLOR_LIGHTRED, string);
TeamChatLog(string);
return 0;
}
}
I've 2 problems.
The first,when i do like ;test - It sends the message in the normal chat and in the team chat,so double messages.
The second,every team can see the team chat.Ex: If i'm team japan,i can see russia team chat,usa team chat and so on,same with other teams.
What's wrong?