Clearchat command for all and player only
#1

Hello, I got a clearchat command for admins to clear all players chats. Now I want to make it for the person who uses it to only clear his chat. I'm still learning and can't get it working, whats wrong?

Код:
CMD:clearchatall(playerid, params[])
{
    if (PlayerData[playerid][pAdmin] < 5)
	    return SendErrorMessage(playerid, "You cannot use this command.");

	for (new i = 0; i < 100; i ++) {
	    SendClientMessageToAll(-1, "");
	}
	return 1;
}
Код:
CMD:clearchat(playerid, params[])
{
	for (new i = 0; i < 100; i ++) {
	    SendClientMessage(-1, "");
	}
	return 1;
}
error 035: argument type mismatch (argument 2)
Reply
#2

Hello!

PHP код:
CMD:clearchatall(playeridparams[])
{
    if (
PlayerData[playerid][pAdmin] < 5)
        return 
SendErrorMessage(playerid"You cannot use this command.");
    for (new 
020++) {
        
SendClientMessageToAll(-1"");
    }
    return 
1;
}
CMD:clearchat(playeridparams[])
{
    for (new 
020++) {
        
SendClientMessage(playerid,-1"");
    }
    return 
1;

It is enough if you write 20 instead of 100 because you can have maximal 20 rows in your chat.

The mistake was that you forgot the "playerid" parameter.


- Mencent
Reply
#3

Код:
CMD:clearchat(playerid, params[])
{
	for (new i = 0; i < 100; i ++) {
	    SendClientMessage(playerid,-1, ""); // you forgot playerid
	}
	return 1;
}
Reply
#4

PHP код:
CMD:clearchat(playeridparams[])
{
    for (new 
0100++) {
        
SendClientMessage(playerid, -1"");
    }
    return 
1;

Reply
#5

Oh that's stupid haha, thanks guys!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)