Team Chat Bug.
#1

When someones typed !hello it's just saying it in the normal chat. So everyone can read it. I hope somebody can help me.

pawn Код:
if(text[0] == '!' && text[1] != 0)
  {
    format( string, 128, "[Team] %s: %s", pInfo[playerid][name], text[1] );
    for(new i = 0; i < MAX_PLAYERS; i++ )
    {
      if( IsPlayerConnected(i) && gTeam[i] == gTeam[i] )
        SendClientMessage( i, teamchat, string );
    }
    return 0;
  }
Reply
#2

Use this.
Код:
public OnPlayerText(playerid,text[])
{
	if(text[0] == '!')
	{
  new name[24], string[256];
  GetPlayerName(playerid, name, 24);
  format(string, sizeof(string), "*%s: %s", name, text[1]);
	printf("%s", string);

  for(new i = 0; i < MAX_PLAYERS; i++)
	{
 	if(IsPlayerConnected(i))
	{
 	if(gTeam[i] == gTeam[playerid])
  	SendClientMessage(i, GetPlayerColor(playerid), string);
		}
	}
	return 0;
}
	return 1;
}
You need to use gTeam. Or this didn't work
Reply
#3

you have a little bug

Код:
if(text[0] == '!' && text[1] != 0)
  {
    format( string, 128, "[Team] %s: %s", pInfo[playerid][name], text[1] );
    for(new i = 0; i < MAX_PLAYERS; i++ )
    {
      if( IsPlayerConnected(i) && gTeam[i] == gTeam[playerid] )
        SendClientMessage( i, teamchat, string );
    }
    return 0;
  }
try with this one
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)