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=364518)



/clearchat command help. - Melon - 30.07.2012

I need help creating a /clearchat command that is created using strcmp as zcmd does not work within my script.

Please help,
Thanks.


Re: /clearchat command help. - SuperViper - 30.07.2012

pawn Код:
if(strcmp(cmdtext, "/clearchat", true) == 0)
{
    for(new i = 0; i < 100; i++)
    {
        SendClientMessage(playerid, -1, "");
    }

    return 1;
}



Re: /clearchat command help. - Melon - 30.07.2012

Okay, thanks. I added that and I get the following:

C:\Users\DAN\Desktop\CSRP\gamemodes\csrp.pwn(45182 ) : error 010: invalid function or declaration
C:\Users\DAN\Desktop\CSRP\gamemodes\csrp.pwn(45184 ) : error 010: invalid function or declaration
C:\Users\DAN\Desktop\CSRP\gamemodes\csrp.pwn(45189 ) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.


Re: /clearchat command help. - Makaveli93 - 30.07.2012

Have you placed it under OnPlayerCommandText ?


Re: /clearchat command help. - DarkB0y - 30.07.2012

pawn Код:
CMD:clearchat(playerid,params[]) {
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 1) {
        CMDMessageToAdmins(playerid,"CLEARCHAT");
        for(new i = 0; i < 11; i++) SendClientMessageToAll(green," "); return 1;
    } else return SendClientMessage(playerid,red,"ERROR: You need to be level 1 to use this command");
}



Re: /clearchat command help. - Melon - 30.07.2012

@
Quote:
Originally Posted by SuperViper
Посмотреть сообщение
pawn Код:
if(strcmp(cmdtext, "/clearchat", true) == 0)
{
    for(new i = 0; i < 100; i++)
    {
        SendClientMessage(playerid, -1, "");
    }

    return 1;
}
Yes, it now works.

Could you please add it so it only works for level 1 admin above and it displays the message 'An Admin has cleared the chat' after the command is used? Thanks.


Re: /clearchat command help. - DarkB0y - 31.07.2012

there you go


Re: /clearchat command help. - Melon - 31.07.2012

Quote:
Originally Posted by X_Boy
Посмотреть сообщение
there you go
Sorry, the code you submitted doesn't work. I need it in the code layout as SuperViper scripted it.


Re: /clearchat command help. - DarkB0y - 31.07.2012

make sure u have the include of the zcmd
pawn Код:
#include <zcmd>



Re: /clearchat command help. - Melon - 31.07.2012

Quote:
Originally Posted by X_Boy
Посмотреть сообщение
make sure u have the include of the zcmd
pawn Код:
#include <zcmd>
Quote:
Originally Posted by Melon
Посмотреть сообщение
I need help creating a /clearchat command that is created using strcmp as zcmd does not work within my script.

Please help,
Thanks.
If I use ZCMD it stops all of my commands from working.