SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 01/01/2011, 08:51 PM   #1
Linus-
Big Clucker
 
Join Date: Nov 2010
Posts: 54
Reputation: 9
Angry Clearchat CMD

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

pawn Code:
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.
Linus- is offline  
Old 01/01/2011, 08:52 PM   #2
HyperZ
High-roller
 
HyperZ's Avatar
 
Join Date: Aug 2009
Posts: 1,340
Reputation: 66
Default Re: Clearchat CMD

Use this its simple.
pawn Code:
if (strcmp("/cc", cmdtext, true, 10) == 0)
    {
        for(new i = 0; i < 50; i++) SendClientMessageToAll(0x33FF33AA," "); return 1;
    }
__________________
HyperZ is offline  
Old 01/01/2011, 08:53 PM   #3
Grim_
High-roller
 
Grim_'s Avatar
 
Join Date: Sep 2008
Location: United States
Posts: 2,862
Reputation: 118
Default Re: Clearchat CMD

Add a literal space in the messages, I have an odd feeling it may be causing it. Also, there is a shortcut:
pawn Code:
if( strcmp( "/cc", cmdtext, true ) == 0 )
{
   for( new i = 0; i < 20; i ++ )
   {
      SendClientMessage( playerid, 0x33FF33AA, " " );
   }
   return 1;
}
Grim_ is offline  
Old 01/01/2011, 08:54 PM   #4
HyperZ
High-roller
 
HyperZ's Avatar
 
Join Date: Aug 2009
Posts: 1,340
Reputation: 66
Default Re: Clearchat CMD

Quote:
Originally Posted by Grim_ View Post
Add a literal space in the messages, I have an odd feeling it may be causing it. Also, there is a shortcut:
pawn Code:
if( strcmp( "/cc", cmdtext, true ) == 0 )
{
   for( new i = 0; i < 20; i ++ )
   {
      SendClientMessage( playerid, 0x33FF33AA, " " );
   }
   return 1;
}
Lol you forgot something. :P
__________________
HyperZ is offline  
Old 01/01/2011, 08:55 PM   #5
Linus-
Big Clucker
 
Join Date: Nov 2010
Posts: 54
Reputation: 9
Default Re: Clearchat CMD

Thanks but how make in ZCMD? plz help
Linus- is offline  
Old 01/01/2011, 08:56 PM   #6
HyperZ
High-roller
 
HyperZ's Avatar
 
Join Date: Aug 2009
Posts: 1,340
Reputation: 66
Default Re: Clearchat CMD

Quote:
Originally Posted by Linus- View Post
Thanks but how make in ZCMD? plz help
pawn Code:
COMMAND:cc( playerid, params[ ] )
{
   for(new i = 0; i < 50; i++) SendClientMessageToAll(0x33FF33AA," "); return 1;
}
__________________
HyperZ is offline  
Old 01/01/2011, 08:57 PM   #7
Scenario
Godfather
 
Scenario's Avatar
 
Join Date: Feb 2010
Location: Heaven
Posts: 7,809
Reputation: 701
Default Re: Clearchat CMD

This should work for you...

pawn Code:
CMD:clearchat(playerid, params[])
{
    for(new i = 0; i < 100; i ++) SendClientMessageToAll(COLOR_GREY, " ");
    return 1;
}
Scenario is offline  
Old 01/01/2011, 08:57 PM   #8
Grim_
High-roller
 
Grim_'s Avatar
 
Join Date: Sep 2008
Location: United States
Posts: 2,862
Reputation: 118
Default Re: Clearchat CMD

@Clive: Care to explain what I missed?

Also, you should add unused params pragma.
pawn Code:
COMMAND:cc( playerid, params[ ] )
{
   #pragma unused params
   for( new i = 0; i < 50; i++ ) SendClientMessage( playerid, 0x33FF33AA, " " ); return 1;
}
Grim_ is offline  
Old 01/01/2011, 08:57 PM   #9
Linus-
Big Clucker
 
Join Date: Nov 2010
Posts: 54
Reputation: 9
Default Re: Clearchat CMD

Quote:
Originally Posted by Clive View Post
pawn Code:
COMMAND:cc( playerid, params[ ] )
{
   for(new i = 0; i < 50; i++) SendClientMessageToAll(0x33FF33AA," "); return 1;
}
Thanks you
Linus- is offline  
Old 01/01/2011, 08:59 PM   #10
HyperZ
High-roller
 
HyperZ's Avatar
 
Join Date: Aug 2009
Posts: 1,340
Reputation: 66
Default Re: Clearchat CMD

Quote:
Originally Posted by Grim_ View Post
@Clive: Care to explain what I missed?

Also, you should add unused params pragma.
pawn Code:
COMMAND:cc( playerid, params[ ] )
{
   #pragma unused params
   for( new i = 0; i < 50; i++ ) SendClientMessage( playerid, 0x33FF33AA, " " ); return 1;
}
It should be.
pawn Code:
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.....
__________________
HyperZ is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/clearchat command for admins? Face9000 Help Archive 2 19/09/2010 02:07 PM
Clearchat Ihsan_Cingisiz Help Archive 6 04/06/2010 08:58 AM
/Cd & /ClearChat _System_ Help Archive 3 07/04/2009 12:36 PM


All times are GMT. The time now is 11:53 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.