Dont disturb mode.
#1

Hey guys,

I would like to know what would be the function to
DISABLE chat for a player so when you do /dnd the playerid will not recieve ANY global chat messages while the chat keeps going for the other players

/dndoff = ChatEnable = 1 (then the player can now see the global chat)
Reply
#2

Return 0 in OnPlayerText() and use SendClientMessage() and foreach in combination with an if-statement instead.
Reply
#3

Example please?
Reply
#4

Here you go
pawn Код:
new Chat[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    Chat[playerid] = 1;
    return 1;
}

CMD:dnd(playerid, params[])
{
    if(Chat[playerid] == 1)
    {
        SendClientMessage(playerid, -1, "You turned mainchat off");
        Chat[playerid] = 0;
    }
    else if(Chat[playerid] == 0)
    {
        SendClientMessage(playerid, -1, "You turned mainchat on");
        Chat[playerid] = 1;
    }
    return 1;
}

public OnPlayerText(playerid, text[])
{
    foreach(Player, i)
    {
        if(Chat[i] == 1)
        {
            SendClientMessage(i, -1, text);
        }
    }
    return 0;
}
Try it, And use a loop through all players instead of you don't have foreach include
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)