Is it possible!!
#4

The above would block text sent by player A and won't reach anyone else because "return 0" blocks the text from that player being sent to the server.

If I get you correctly, you want player A to be unable to see whatever another player says?
Everyone could be chatting along nicely, but you don't want Player A to see all the messages?

Then you can use the same approach (ChatBlocked variable).
Every time a player inputs some text into the chatbox and presses ENTER, OnPlayerText is called.
You can loop through all players and use SendClientMessage to send the text to him if his chat isn't blocked.
And of course, block the inputted text using "return 0", otherwise the text will still be send to all players.

pawn Код:
new bool:ChatBlocked[MAX_PLAYERS];

public OnPlayerText(playerid, text[])
{
    // Setup local variables
    new Msg[128], Name[24];

    // Get the player's name
    GetPlayerName(playerid, Name, 24);

    // Pre-format the text to be sent
    format(Msg, 128, "%s: %s", Name, text);

    // Send the inputted text to all players who are NOT blocked
    for (new i; i < MAX_PLAYERS; i++)
    {
        // If this player is allowed to see chat from other players
        if (ChatBlocked[i] == false)
        {
            // Send the text to him
            SendClientMessage(i, 0xFFFFFFFF, Msg);
        }
    }

    // Block the text from appearing normally in everyone's chatbox
    return 0;
}
Reply


Messages In This Thread
Is it possible!! - by HitterHitman - 06.01.2014, 13:52
Re: Is it possible!! - by jakejohnsonusa - 06.01.2014, 14:02
Re: Is it possible!! - by Tayab - 06.01.2014, 14:52
Re: Is it possible!! - by PowerPC603 - 06.01.2014, 15:43

Forum Jump:


Users browsing this thread: 1 Guest(s)