/clearchat command help
#1

Hello, i have a /clearchat command and i want it so it only clears my chat. right now it will clear everyones chat. Can someone help. Here is the code

Код:
CMD:clearchat(playerid, params[])
{
	foreach(Player, i)
	{
		if(PlayerInfo[playerid][pAdmin] >= 2)
		{
			for(new e = 0; e < 4; e++) ClearChatbox(i);
		}
	}
	return 1;
}
Reply
#2

pawn Код:
CMD:clearmychat(playerid, params[])
{
    for(new i = 0; i < 100; i ++) SendClientMessage(playerid, -1, "");
    return 1;
}
Was that hard?
Reply
#3

Use this function.

Код:
ClearChat(playerid=-1) {
     for(new i = 0; i < 20; i++) {
       if(playerid == -1) {
         SendClientMessageToAll(-1, " ");
       } else {
         SendClientMessage(playerid, -1, " ");
       }
     }
  }
}
Which you can convert in your command:

Код:
CMD:clearchat(playerid,params[]) {
  new clearid;
  if(sscanf(params,"i",clearid)) {
    ClearChat();
  } else {
    if(!IsPlayerConnected(playerid) || clearid == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"Wrong player");
    ClearPlayerChat(playerid);
  }
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)