/clearchat command help.
#1

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

Please help,
Thanks.
Reply
#2

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

    return 1;
}
Reply
#3

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.
Reply
#4

Have you placed it under OnPlayerCommandText ?
Reply
#5

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");
}
Reply
#6

@
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.
Reply
#7

there you go
Reply
#8

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.
Reply
#9

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)