29.09.2011, 00:33
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:
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:
suppress chat on skin selection (i would use the OnPlayerConnect here aswell)
to allow the chat after spawn:
not tested, its the concept idea only, but i hope you get how simple it works ^^
Code:
new AllowChat[MAX_PLAYERS];
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; }
Code:
OnPlayerRequestClass(playerid, classid){ //... AllowChat[playerid]=0; //... }
Code:
OnPlayerSpawn(playerid, classid){ //... AllowChat[playerid]=1; //... }