TEAM CHAT
#1

How can i do team chat?

TEAM_RED:
/f <text>

?
Reply
#2

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;
}
Reply
#3

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
Reply
#4

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.
Reply
#5

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
Reply
#6

How can i define gteam?
Reply
#7

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

Do you have any teams yet?
Reply
#9

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


Forum Jump:


Users browsing this thread: 1 Guest(s)