SA-MP Forums Archive
Team Chat Bug. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Team Chat Bug. (/showthread.php?tid=123767)



Team Chat Bug. - ~Dangun! - 27.01.2010

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;
  }



Re: Team Chat Bug. - leaNN! - 27.01.2010

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


Re: Team Chat Bug. - SlashPT - 27.01.2010

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