06.01.2014, 14:52
If I got correctly, this is what you want to do basically. Read the comments carefully.
pawn Код:
//Create a variable where you'll store wheather the chat should be blocked or not.
new ChatBlocked[MAX_PLAYERS];
// Un-Block the chat when player connects
public OnPlayerConnect(playerid)
{
ChatBlocked[playerid] = 0;
return 1;
}
public OnPlayerText(playerid,text[])
{
//check if the player is blocked for getting chats from all players
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(ChatBlocked[i] == 1)
{
return 0;
}
else SendClientMessageToAll(GetPlayerColor(playerid),text);
}
return 1;
}
//now you can make command to (un)block the chat for player.
CMD:chatblock(playerid,params[])
{
new pID,value;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xCCCCCCCC,"You're not a RCON admin.");
if(sscanf(params,"ud",pID,value)) return SendClientMessage(playerid,0xFFFFFFFF,"USAGE: /chatblock [playerid] [value]");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,0xCCCCCCCC,"Player is not connected.");
if(!(-1 < value < 2)) return SendClientMessage(playerid,0xCCCCCCCC,"Invalid value [0-1]");
ChatBlocked[playerid] = value;
return 1;
}