Clearchat CMD
#1

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

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

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;
}
Reply
#4

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
Reply
#5

Thanks but how make in ZCMD? plz help
Reply
#6

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

This should work for you...

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

@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;
}
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)