SA-MP Forums Archive
TEAM CHAT - 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 (/showthread.php?tid=182019)



TEAM CHAT - Twain32 - 08.10.2010

How can i do team chat?

TEAM_RED:
/f <text>

?


Re: TEAM CHAT - Jeffry - 08.10.2010

Try:

pawn Код:
if(!strcmp(cmdtext, "/f", true))
{
    new string[128], Player[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Player, MAX_PLAYER_NAME);
    format(string, 128, "Team Chat: %s: %s", Player, cmdtext[2]);
    for(new i=0; i<MAX_PLAYERS; i++) if(gTeam[i]==TEAM_RED) SendClientMessage(i, COLOR_RED, string);
    return 1;
}



Re: TEAM CHAT - Brian_Furious - 08.10.2010

Quote:
Originally Posted by Jeffry
Посмотреть сообщение
Try:

pawn Код:
if(!strcmp(cmdtext, "/f", true))
{
    new string[128], Player[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Player, MAX_PLAYER_NAME);
    format(string, 128, "Team Chat: %s: %s", Player, cmdtext[2]);
    for(new i=0; i<MAX_PLAYERS; i++) if(gTeam[i]==TEAM_RED) SendClientMessage(i, COLOR_RED, string);
    return 1;
}
I agree with you but he need to define
Код:
gTeam



Re: TEAM CHAT - Jeffry - 08.10.2010

Well, or he just changes "gTeam" to his Team-Variables. ^^
I just used gTeam, as this is the most used Team-Variable.

Let's wait for his answer.


Re: TEAM CHAT - Brian_Furious - 08.10.2010

Quote:
Originally Posted by Jeffry
Посмотреть сообщение
Well, or he just changes "gTeam" to his Team-Variables. ^^
I just used gTeam, as this is the most used Team-Variable.

Let's wait for his answer.
It's difficult to wait his answer, you can see that he's offline


Re: TEAM CHAT - Twain32 - 25.10.2010

How can i define gteam?


Re: TEAM CHAT - Miguel - 25.10.2010

new gTeam[MAX_PLAYERS]; // Out of any callback or function (global variable).


Re: TEAM CHAT - Jeffry - 25.10.2010

Do you have any teams yet?


AW: TEAM CHAT - Saitecx - 25.10.2010

pawn Код:
new string[256];
  new playername[MAX_PLAYER_NAME];
  if(text[0] == '!' && text[1] != 0)
  {
    GetPlayerName( playerid, playername, MAX_PLAYER_NAME );
    format( string, 128, "[Team-Chat] %s: %s", playername, text[1] );
    for(new i = 0; i < MAX_PLAYERS; i++ )
    {
      if( IsPlayerConnected(i) && gTeam[playerid] == gTeam[i] )
        SendClientMessage( i, COLOR_YELLOW, string );
    }
    return 0;
  }