[NOT SOLVED!]Teamchat?
#1

Hello, I made a tdm server, (with gteams) and i need help with making it so theres a teamchat so if someone puts something like "@" before talking, then it sends it to their whole team..

How do I do this?

Thanks a bunch
Reply
#2

Add this to your GM

pawn Код:
public OnPlayerText(playerid,text[])
{
    if(text[0] == '@')
    {
      new string[128];  GetPlayerName(playerid, string, sizeof(string));
      format(string, sizeof(string), "*Equip: %s: %s", string, text[1]);
        printf("%s", string);
      for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && gTeam[i] == gTeam[playerid]) SendClientMessage(i, GetPlayerColor(playerid), string);
        }
        return 0;
    }
    return 1;
}
Reply
#3

Thanks, but how do I make it show the stuff that the person is typing as white? its kinda hard to read it in all one color.
Reply
#4

That code sends player message to all players with the same team as him, and the message is sended with the players colour. Ex: "@ hi all", if i am colour red the message will be red and will be sent to all players of my team.

Sorry my bad english
Reply
#5

Quote:
Originally Posted by agusfn20
That code sends player message to all players with the same team as him, and the message is sended with the players colour. Ex: "@ hi all", if i am colour red the message will be red and will be sent to all players of my team.

Sorry my bad english
Yes, I know, but I want the text of what the player is saying to be white..

Example:
"TEAM: NAME: Blablabla"
Reply
#6

pawn Код:
public OnPlayerText(playerid,text[])
{
    if(text[0] == '@')
    {
      new string[128];  GetPlayerName(playerid, string, sizeof(string));
      format(string, sizeof(string), "gTeamnamehere %s: %s", string, text[1]); // Specify which gTeams you need this for.
        printf("%s", string);
      for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && gTeam[i] == gTeam[playerid]) SendClientMessage(i, COLOR_WHITE, string); // Changes color to white, not what color player is.
        }
        return 0;
    }
    return 1;
}
Reply
#7

What you're asking for is SendPlayerMessageToPlayer, instead of SendClientMessage.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)