Team Chat
#1

Hello everybody.I tryed all type of codes for Team Chat But not working anyone got any idea??
Reply
#2

I hope it will be useful for you:
pawn Код:
public OnPlayerText(playerid, text[])
{
    if (text[0] == '@') {
        text[0] = ' ';
        new msg[128], pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, sizeof(pName));
        format(msg, sizeof(msg), "[Team][%s]:%s", pName, text);
        for (new i = 0; i < GetMaxPlayers(); i++) {
            if (GetPlayerTeam(playerid) == GetPlayerTeam(i))
                SendPlayerMessageToPlayer(i, playerid, msg);
        }
        return 0;
    }
    return 1;
}
Reply
#3



Here is picture how its looks when i did wha Nonameman give me.I dont know how to fix that....
Reply
#4

this is what i am using for team chat:
it will work surely :

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

Quote:
Originally Posted by vassilis
Посмотреть сообщение
this is what i am using for team chat:
it will work surely :

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;
    }
Huh finaly working rep++
Reply
#6

Quote:
Originally Posted by SpiderWalk
Посмотреть сообщение
Huh finaly working rep++
Haha no problem.
Reply
#7

Quote:
Originally Posted by vassilis
Посмотреть сообщение
this is what i am using for team chat:
it will work surely :

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;
    }
Idk why I used SendPlayerMessageToPlayer(), thanks for fixing it.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)