SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 06/05/2011, 03:25 AM   #1
Type-R
Huge Clucker
 
Type-R's Avatar
 
Join Date: Feb 2011
Posts: 292
Reputation: 5
Default /clearchat?

Hi is there anyway of making a command /clearchat that would clear out the chat, like move the messages up?
__________________
Type-R is offline  
Old 06/05/2011, 03:28 AM   #2
o_O
Big Clucker
 
Join Date: May 2011
Posts: 66
Reputation: 0
Default Re: /clearchat?

Send several /n.
o_O is offline  
Old 06/05/2011, 03:28 AM   #3
Alex_Obando
Gangsta
 
Join Date: Jan 2011
Posts: 564
Reputation: 9
Default Respuesta: /clearchat?

pawn Code:
// === [Clearchat] ===
    if(strcmp(cmdtext, "/clearchat", true) == 0)
    {
                SendClientMessageToAll(COLOR_SYSTEM, " ");
                SendClientMessageToAll(COLOR_SYSTEM, " ");
                SendClientMessageToAll(COLOR_SYSTEM, " ");
                SendClientMessageToAll(COLOR_SYSTEM, " ");
                SendClientMessageToAll(COLOR_SYSTEM, " ");
                SendClientMessageToAll(COLOR_SYSTEM, " ");
                SendClientMessageToAll(COLOR_SYSTEM, " ");
                SendClientMessageToAll(COLOR_SYSTEM, " ");
                SendClientMessageToAll(COLOR_SYSTEM, " ");
                SendClientMessageToAll(COLOR_SYSTEM, " ");
                SendClientMessageToAll(COLOR_SYSTEM, " ");
                SendClientMessageToAll(COLOR_SYSTEM, " ");
                SendClientMessageToAll(COLOR_SYSTEM, " ");
                SendClientMessageToAll(COLOR_SYSTEM, " ");
                SendClientMessageToAll(COLOR_SYSTEM, " ");
                SendClientMessageToAll(COLOR_SYSTEM, " ");
                GameTextForAll("Chat cleared!", 1000,1);
                                return 1;
            }
Alex_Obando is offline  
Old 06/05/2011, 03:34 AM   #4
o_O
Big Clucker
 
Join Date: May 2011
Posts: 66
Reputation: 0
Default Re: /clearchat?

Mega fail. I meant to say white spaces, not /n.

Thank you, Alex.
o_O is offline  
Old 06/05/2011, 03:48 AM   #5
Type-R
Huge Clucker
 
Type-R's Avatar
 
Join Date: Feb 2011
Posts: 292
Reputation: 5
Default Re: /clearchat?

OMG i couldn't think that for my self... Than you!!!
__________________
Type-R is offline  
Old 06/05/2011, 03:57 AM   #6
o_O
Big Clucker
 
Join Date: May 2011
Posts: 66
Reputation: 0
Default Re: /clearchat?

Btw, you should use a for statement.
o_O is offline  
Old 06/05/2011, 06:38 AM   #7
Seven_of_Nine
Huge Clucker
 
Seven_of_Nine's Avatar
 
Join Date: Feb 2011
Location: Hungary
Posts: 372
Reputation: 12
Default Re: /clearchat?

I use a loop, instead of much SendClientMessage-s.
pawn Code:
COMMAND:clearchat(playerid) {
    new
        name1[30],
        text[128];
    if(PlayerInfo[playerid][pAdminLevel] >= 3) {
        for(new i = 0; i < 100; i++) {
            SendClientMessageToAll(COLOR_WHITE," ");
        }
        GetPlayerName(playerid,name1,sizeof(name1));
        format(text,sizeof(text),"Administrator \"%s\" has cleared the chat.",name1);
        SendClientMessageToAll(medblue,text);
        SaveIn("clearchat",text);
    } else {
        return SendClientMessage(playerid,red,"Only lvl3 or higher admins can use this command.");
    }
    return 1;
}
__________________
- seven
Seven_of_Nine is offline  
Old 06/05/2011, 10:55 AM   #8
Calgon
Banned
 
Join Date: Jan 2009
Posts: 6,136
Reputation: 1127
Default Re: /clearchat?

Using a loop instead of static code is less efficient.
Calgon is offline  
Old 06/05/2011, 01:50 PM   #9
Mean
High-roller
 
Join Date: Jul 2010
Location: 14th annual lemon party
Posts: 2,727
Reputation: 229
Default Re: /clearchat?

Quote:
Originally Posted by Seven_of_Nine View Post
I use a loop, instead of much SendClientMessage-s.
pawn Code:
COMMAND:clearchat(playerid) {
    new
        name1[30],
        text[128];
    if(PlayerInfo[playerid][pAdminLevel] >= 3) {
        for(new i = 0; i < 100; i++) {
            SendClientMessageToAll(COLOR_WHITE," ");
        }
        GetPlayerName(playerid,name1,sizeof(name1));
        format(text,sizeof(text),"Administrator \"%s\" has cleared the chat.",name1);
        SendClientMessageToAll(medblue,text);
        SaveIn("clearchat",text);
    } else {
        return SendClientMessage(playerid,red,"Only lvl3 or higher admins can use this command.");
    }
    return 1;
}
That's copied, he doesn't have thoose AdminLevel vars. So
pawn Code:
CMD:clearchat( playerid, params[ ] )  {
    for( new i = 0; i < 50; i++ ) SendClientMessageToAll( -1, " " );
    return 1;
}


@Calgon: Could be, but this is shorter.
__________________
I'm pretty much the creator of the PUB: macro used in many scripts today, therefore I'm a legitimate genius.

Ground breaking stuff
Quote:
Originally Posted by ******
I've met Mean on a few occasions in real life, a true genius and a 400 pound all-muscle gorilla alpha male. He has had a great influence on my life.
Quote:
Originally Posted by Kalcor
I don't know where I'd be today without Mean. He has helped me through some tough times in my life. He always brings a smile to my face. Such a positive lad!
Mean is offline  
Old 06/05/2011, 03:05 PM   #10
Seven_of_Nine
Huge Clucker
 
Seven_of_Nine's Avatar
 
Join Date: Feb 2011
Location: Hungary
Posts: 372
Reputation: 12
Default Re: /clearchat?

Lol that'd return a warning, because you didn't use the params[].
pawn Code:
COMMAND:clearchat(playerid)  {
    if(IsPlayerAdmin(playerid) {
        for(new i = 0; i < 100; i++) SendClientMessageToAll(-1, " " );
    } else {
        return SendClientMessage(playerid,red,"ERROR: This command is only avaible for admins.");
    }
    return 1;
}
__________________
- seven
Seven_of_Nine is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clearchat CMD Linus- Help Archive 29 02/01/2011 08:29 PM
/clearchat command for admins? Face9000 Help Archive 2 19/09/2010 02:07 PM
Clearchat Ihsan_Cingisiz Help Archive 6 04/06/2010 08:58 AM
/Cd & /ClearChat _System_ Help Archive 3 07/04/2009 12:36 PM


All times are GMT. The time now is 01:22 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.