17.08.2011, 11:43
Try my TeamChat, use '!<Text>' ingame, no spaces.
Remember, change 'gTeam' variable to your code's 'gTeam' variable.
Also you need foreach for my code.
pawn Код:
// Teamchat
public OnPlayerText( playerid, text[ ] )
{
if ( text[ 0 ] = '!' && text[ 1 ] != ' ' )
{
foreach (Player, i) // Loop
{
if ( gTeam[ playerid ] == gTeam[ i ] ) // if the team is same
{
new
szString[ 128 ],
pName[ 24 ]
;
GetPlayerName( playerid, pName, 24 );
if ( text[ 0 ] == '!' )
text[ 0 ] = ' ';
format( szString, 128, "TEAMCHAT [ %s ] :%s", pName, text );
SendClientMessage( i, -1, szString );
}
}
}
return 1;
}
Also you need foreach for my code.