SA-MP Forums Archive
need help with scripting the chat clear - 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: need help with scripting the chat clear (/showthread.php?tid=464309)



need help with scripting the chat clear - BarFix - 16.09.2013

i need help with scripting something.
i want a command like /clearchat
and that clear the chat.
how to script that.


Re: need help with scripting the chat clear - EiresJason - 16.09.2013

ZCMD:
pawn Код:
//removed because I do not know what i was thinking writing this command.
If you need it for a different command processor; let me know.


Re: need help with scripting the chat clear - BarFix - 23.09.2013

Quote:

(7744) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

how to fix that?


Re: need help with scripting the chat clear - DanishHaq - 23.09.2013

EriesJohnson, there are quite a few problems in that code... try this instead:

pawn Код:
CMD:clearchat(playerid, params[])
{
    for(new i = 0; i < 100; i ++)
    {
         SendClientMessageToAll(0xFFFFFFFF, "");
    }
    return 1;
}



Re: need help with scripting the chat clear - EiresJason - 23.09.2013

I have no idea why I posted that code lol.

Though; I think calling me EriesJohnson may be a bit worse haha :P


Re: need help with scripting the chat clear - DanishHaq - 23.09.2013

Quote:
Originally Posted by EiresJason
Посмотреть сообщение
I have no idea why I posted that code lol.

Though; I think calling me EriesJohnson may be a bit worse haha :P
LOL, sorry mate. I just read your name whilst I was scrolling down, I probably had about half a second to read it and remember it and then started posting, didn't even do a copy+paste, .


Re: need help with scripting the chat clear - EiresJason - 23.09.2013

Hehe :P


Re: need help with scripting the chat clear - ic3cr3am - 23.09.2013

This all you do is send a bunch of blank messages to all,

Quote:

if (strcmp("/clearchat", cmdtext, true, 13) == 0)//the command
{
if(IsPlayerAdmin(playerid))//is player rcon admin
{//then
SendClientMessagesForAll(-1, " ");//send blank message to all
SendClientMessagesForAll(-1, " ");//send blank message to all
SendClientMessagesForAll(-1, " ");//send blank message to all
SendClientMessagesForAll(-1, " ");//send blank message to all
SendClientMessagesForAll(-1, " ");//send blank message to all
SendClientMessagesForAll(-1, " ");//send blank message to all
SendClientMessagesForAll(-1, " ");//send blank message to all
return 1;
}
else//if player is not rcon admin
{//then
SendClientMessages(playerid, -1, "You are not a rcon admin");//send messages to player who used command, but is not rcon admin
}
}




Re: need help with scripting the chat clear - Konstantinos - 23.09.2013

Quote:
Originally Posted by ic3cr3am
Посмотреть сообщение
This all you do is send a bunch of blank messages to all,
"/clearchat" has lenght of 10, not 13. Plus sending 7 lines is not enough. I use /pagesize 20 so I'm still able to read the chat + if I scroll up.


Re: need help with scripting the chat clear - PT - 23.09.2013

Quote:
Originally Posted by DanishHaq
Посмотреть сообщение
EriesJohnson, there are quite a few problems in that code... try this instead:

pawn Код:
CMD:clearchat(playerid, params[])
{
    for(new i = 0; i < 100; i ++)
    {
         SendClientMessageToAll(0xFFFFFFFF, "");
    }
    return 1;
}
that will do a small " lag " in server reduce the loop, 30 enough