[HELP] Disable Chat to certain player, please.
#5

usually the SendClientMessageToAll() gets used for sending a chat to all players. what you need, is an array holding all players, with a value to allow the chat output:
Code:
new AllowChat[MAX_PLAYERS];
then, instead of SendClientMessageToAll(), make a loop, checking if the AllowChat[playerid]==1 - if set to 0 (when logging in, ergo not set to 1 before spawning), then dont send the chat line. this will require a bit processing time due to the loop:
Code:
public OnPlayerText(playerid, text[]){
//SendClientMessageToAll(0xffffffff,text); //disabled this, and replaced by the following loop:
new MaxPlayers=GetMaxPlayers();
for(new id=0;id<MaxPlayers;id++)
{
	if(AllowChat[id]==1)// dont forget to set this to 1 when spawning!
	{
		SendClientMessage(id,0xffffffff,text);
	}
	return 1;
}
suppress chat on skin selection (i would use the OnPlayerConnect here aswell)
Code:
OnPlayerRequestClass(playerid, classid){
	//...
	AllowChat[playerid]=0;
	//...
}
to allow the chat after spawn:
Code:
OnPlayerSpawn(playerid, classid){
	//...
	AllowChat[playerid]=1;
	//...
}
not tested, its the concept idea only, but i hope you get how simple it works ^^
Reply


Messages In This Thread
[HELP] Disable Chat to certain player, please. - by Avalanche! - 28.09.2011, 22:45
Re: [HELP] Disable Chat to certain player, please. - by grand.Theft.Otto - 28.09.2011, 23:18
Re: [HELP] Disable Chat to certain player, please. - by Avalanche! - 28.09.2011, 23:45
Re: [HELP] Disable Chat to certain player, please. - by brett7 - 29.09.2011, 00:03
Re: [HELP] Disable Chat to certain player, please. - by Babul - 29.09.2011, 00:33
Re: [HELP] Disable Chat to certain player, please. - by Scenario - 29.09.2011, 00:40
Re: [HELP] Disable Chat to certain player, please. - by brett7 - 29.09.2011, 00:43

Forum Jump:


Users browsing this thread: 1 Guest(s)