Help with Team Chat needed...
#1

Firstly : Hi
Secondly: I searched on the forums for some working code and the codes didn't work for me.
Thirdly: My team chat code:

Код:
public OnPlayerText(playerid, text[])
{

  new i; new pname[128]; GetPlayerName(playerid,pname,sizeof(pname));
  new string2[256];
  if(text[0]=='@')
	{
		
		switch(gTeam[playerid])
		{
		  case TEAM_HYDRA:
		  		{
    				  for(i=0;i<=MAX_PLAYERS;i++)
				  {
					if(gTeam[i]==gTeam[playerid])
					{
						format(string2,sizeof(string2),"[DEFENDERS] %s: %s",pname,text[1]);
						return SendClientMessage(i,0x0000ffaa,string2);
     					}
  				  }
				}
		  case TEAM_HYDRA2:
			       {
			          for(i=0;i<=MAX_PLAYERS;i++)
				   {
					if(gTeam[i]==gTeam[playerid])
					{
						format(string2,sizeof(string2),"[ATTACKERS] %s: %s",pname,text[1]);
						return SendClientMessage(i,0xff0000aa,string2);
					}
    				    }
      				}
		}
		
	 }

	return 1;
}
Problem: I tried reurning 0 everywhere but in vain. When try to team chat with @ text, the team get's the message in chat but the message is also announced in the normal chat. So, I need some help to get this code working.

Thanks for reading.
Reply
#2

use strcmp to compare strings not ==
Reply
#3

But the problem is not "team chat not being displayed".It does work some-what. The problem is that it ALSO sends a normal chat which I don't want.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)