Team Chat help[rep]
#4

It's very easy.

pawn Код:
#include <a_samp>
#include <YSI\y_va>

public OnPlayerText(playerid, text[])
{
    if(msg[0] = '!')
    {
        for (new i = 0; i != MAX_PLAYERS; ++i)
        {
            if(IsPlayerConnected(i) && (gTeam[i] == gTeam[playerid])
                Msg(playerid, 0xC8C8C8FF, "[Team Msg] %s: %s", PlayerNameEx(playerid), msg[1]);
        }
        return 0;
    }
    return 1;
}

stock PlayerNameEx(playerid)
{
    new
        playerName[MAX_PLAYER_NAME+1],
        string[MAX_PLAYER_NAME+1+7];

    GetPlayerName(playerid, playerName, sizeof(playerName));
    format(string, sizeof(string), "%s (%d)", playerName, playerid);
    return string;
}

stock Msg(playerid, color, const fmat[], va_args<>)
{
    return SendClientMessage(playerid, color, va_return(fmat, va_start<3>));
}
Hope i helped.
If a player types "!hello" it will be sent to their team in this format: "[Team Chat] Name (ID): hello"
Reply


Messages In This Thread
Team Chat help[rep] - by [SU]Spartan - 07.09.2014, 14:55
Re: Team Chat help[rep] - by Fred1993 - 07.09.2014, 14:57
Re: Team Chat help[rep] - by [SU]Spartan - 07.09.2014, 15:13
Re: Team Chat help[rep] - by iFarbod - 07.09.2014, 15:17
Re: Team Chat help[rep] - by [SU]Spartan - 07.09.2014, 15:20
Re: Team Chat help[rep] - by iFarbod - 07.09.2014, 15:21
Re: Team Chat help[rep] - by [SU]Spartan - 07.09.2014, 15:23
Re: Team Chat help[rep] - by iFarbod - 07.09.2014, 15:24
Re: Team Chat help[rep] - by [SU]Spartan - 07.09.2014, 15:25
Re: Team Chat help[rep] - by iFarbod - 07.09.2014, 15:28

Forum Jump:


Users browsing this thread: 1 Guest(s)