new string[256];
new playername[MAX_PLAYER_NAME];
if(text[0] == '!' && text[1] != 0)
{
GetPlayerName( playerid, playername, MAX_PLAYER_NAME );
format( string, 128, "[Team-Chat] %s: %s", playername, text[1] );
if(GetPlayerTeam(playerid) == 1)
{
for(new i = 0; i < MAX_PLAYERS; i++ )
{
SendClientMessage( i, yellow, string );
}
}
if(GetPlayerTeam(playerid) == 2)
{
for(new i = 0; i < MAX_PLAYERS; i++ )
{
SendClientMessage( i, yellow, string );
}
}
return 0;
}
for(new i = 0; i < MAX_PLAYERS; i++ )
{
if(GetPlayerTeam(i) == 1 && IsPlayerConnected(i))
{
SendClientMessage( i, yellow, string );
}
}
for(new i = 0; i < MAX_PLAYERS; i++ )
{
if(GetPlayerTeam(i) == 2 && IsPlayerConnected(i))
{
SendClientMessage( i, yellow, string );
}
}
I have problem but i dont know how to fix it.
Problem is in this:When i type "!Hi" all 2 teams see that message not just 1 team but all teams see that message and i dont know how to fix that! pawn Код:
|
//
if( (text[0] == '!') && (text[1] != 0) ) {
new
i,
string[256],
team = GetPlayerTeam(playerid)
;
GetPlayerName( playerid, string, MAX_PLAYER_NAME );
format( string, sizeof string, "[Team-Chat] %s: %s", string, text[1] );
for( ; i != MAX_PLAYERS; ++i ) {
if( GetPlayerTeam(i) == team ) {
SendClientMessage( i, yellow, string );
}
}
return 0;
}