Team Chat help +Rep
#1

I Have a teamchat for individual teams, but I got 3 teams that are allies. [Im using gTeam]
I have no idea how to do a chat system putting the three teams together.
Ill give rep to anyone who can help me with this.
Reply
#2

Try this one:

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

	return 1;
}
Use # [Text] for team chat.
Reply
#3

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

Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '#')
    {
    new string[128];
	GetPlayerName(playerid, string, sizeof(string));
    format(string, sizeof(string), "[Team Chat] %s (%d): %s", string, playerid, text[1]);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i) && gTeam[i] == gTeam[playerid]) SendClientMessage(i, GetPlayerColor(playerid), string);
    }
    return 0;
    }	return 1;
}
Use # [Text] for team chat.
Thats teamchat for individual gTeams. I need one Linking 3 teams together. The first 3 infact.
Reply
#4

Well, first you should check the player team and then in the loop that loops thru all players, you should check if gteam[i] == 0 or gteam[i] == 1 or gteam[i] == 2
Reply
#5

Would this work, Im unabled to test it atm
Quote:

public OnPlayerText(playerid, text[])
{
if(text[0] == '!') //change ! to what variable u wanna use
{
new string[128]; GetPlayerName(playerid, string, sizeof(string));
format(string, sizeof(string), "[RADIO]%s: %s", string, text[1]);
printf("%s", string);

for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && gTeam[i] == 1||2||3) SendClientMessage(i, GetPlayerColor(playerid), string);
}
return 0;
}
new string[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(string, sizeof(string), "[%d]%s: %s", playerid, pName, text);
SendClientMessageToAll(GetPlayerColor(playerid), string);
return 0;
}

Reply
#6

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        if ( gTeam[i] == 1 || gTeam[i] == 2 || gTeam[i] == 3 )
            SendClientMessage(i, GetPlayerColor(playerid), string);
    }
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)