SA-MP Forums Archive
/clearchat command help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /clearchat command help (/showthread.php?tid=574836)



/clearchat command help - Godzilla8957 - 21.05.2015

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;
}



Re: /clearchat command help - SickAttack - 21.05.2015

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


Re: /clearchat command help - icra - 21.05.2015

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);
  }
}