Help with Team Chat needed... - 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: Help with Team Chat needed... (
/showthread.php?tid=152244)
Help with Team Chat needed... -
DJDhan - 03.06.2010
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.
Re: Help with Team Chat needed... -
cessil - 03.06.2010
use strcmp to compare strings not ==
Re: Help with Team Chat needed... -
DJDhan - 03.06.2010
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.