SA-MP Forums Archive
Clearchat CMD - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Clearchat CMD (/showthread.php?tid=205588)



Clearchat CMD - Linus- - 01.01.2011

Hey, i have this cmd /cc
sometimes when i typed it it crash my server

pawn Код:
if (strcmp("/cc", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid,0x33FF33AA,"");
        SendClientMessage(playerid,0x33FF33AA,"");
        SendClientMessage(playerid,0x33FF33AA,"");
        SendClientMessage(playerid,0x33FF33AA,"");
        SendClientMessage(playerid,0x33FF33AA,"");
        SendClientMessage(playerid,0x33FF33AA,"");
        SendClientMessage(playerid,0x33FF33AA,"");
        SendClientMessage(playerid,0x33FF33AA,"");
        SendClientMessage(playerid,0x33FF33AA,"");
        SendClientMessage(playerid,0x33FF33AA,"");
        return 1;
    }
How to fix it?

Sorry for bad english.


Re: Clearchat CMD - HyperZ - 01.01.2011

Use this its simple.
pawn Код:
if (strcmp("/cc", cmdtext, true, 10) == 0)
    {
        for(new i = 0; i < 50; i++) SendClientMessageToAll(0x33FF33AA," "); return 1;
    }



Re: Clearchat CMD - Grim_ - 01.01.2011

Add a literal space in the messages, I have an odd feeling it may be causing it. Also, there is a shortcut:
pawn Код:
if( strcmp( "/cc", cmdtext, true ) == 0 )
{
   for( new i = 0; i < 20; i ++ )
   {
      SendClientMessage( playerid, 0x33FF33AA, " " );
   }
   return 1;
}



Re: Clearchat CMD - HyperZ - 01.01.2011

Quote:
Originally Posted by Grim_
Посмотреть сообщение
Add a literal space in the messages, I have an odd feeling it may be causing it. Also, there is a shortcut:
pawn Код:
if( strcmp( "/cc", cmdtext, true ) == 0 )
{
   for( new i = 0; i < 20; i ++ )
   {
      SendClientMessage( playerid, 0x33FF33AA, " " );
   }
   return 1;
}
Lol you forgot something. :P


Re: Clearchat CMD - Linus- - 01.01.2011

Thanks but how make in ZCMD? plz help


Re: Clearchat CMD - HyperZ - 01.01.2011

Quote:
Originally Posted by Linus-
Посмотреть сообщение
Thanks but how make in ZCMD? plz help
pawn Код:
COMMAND:cc( playerid, params[ ] )
{
   for(new i = 0; i < 50; i++) SendClientMessageToAll(0x33FF33AA," "); return 1;
}



Re: Clearchat CMD - Scenario - 01.01.2011

This should work for you...

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



Re: Clearchat CMD - Grim_ - 01.01.2011

@Clive: Care to explain what I missed?

Also, you should add unused params pragma.
pawn Код:
COMMAND:cc( playerid, params[ ] )
{
   #pragma unused params
   for( new i = 0; i < 50; i++ ) SendClientMessage( playerid, 0x33FF33AA, " " ); return 1;
}



Re: Clearchat CMD - Linus- - 01.01.2011

Quote:
Originally Posted by Clive
Посмотреть сообщение
pawn Код:
COMMAND:cc( playerid, params[ ] )
{
   for(new i = 0; i < 50; i++) SendClientMessageToAll(0x33FF33AA," "); return 1;
}
Thanks you


Re: Clearchat CMD - HyperZ - 01.01.2011

Quote:
Originally Posted by Grim_
Посмотреть сообщение
@Clive: Care to explain what I missed?

Also, you should add unused params pragma.
pawn Код:
COMMAND:cc( playerid, params[ ] )
{
   #pragma unused params
   for( new i = 0; i < 50; i++ ) SendClientMessage( playerid, 0x33FF33AA, " " ); return 1;
}
It should be.
pawn Код:
COMMAND:cc( playerid, params[ ] )
{
   #pragma unused params
   for( new i = 0; i < 50; i++ ) SendClientMessageToAll(0x33FF33AA, " "); return 1;
}
Edit: i guess u edited ur post.....