Raised This Month: $ Target: $400
 0% 

Question about colorchat


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pillowCloud
Member
Join Date: Aug 2015
Location: AlliedModders
Old 05-05-2016 , 22:02   Question about colorchat
Reply With Quote #1

A nooby question:

I'm using this colorchat stock:
PHP Code:
stock ColorChat( const client, const string[], any:... )
{
    new 
msg191 ], players32 ], count 1;
    static 
lenlen formatexmsgcharsmaxmsg ), "^4[^1 MyClan ^4]^1 " );
    
vformatmsglen ], charsmaxmsg ) - lenstring);
    
    if( 
client )  players] = client;
    else    
get_playersplayers,count,"ch" );
    
    for ( new 
0counti++ )
    {
        if( 
is_user_connectedplayers] ) )
        {
            
message_beginMSG_ONE_UNRELIABLEget_user_msgid"SayText" ), _players] );
            
write_byteplayers] );
            
write_stringmsg );
            
message_end( );
        }
    }
    return 
PLUGIN_HANDLED;

and when I type something like this:
PHP Code:
ColorChat(0"^4%s blablabla"Example); 
The connection of: ^4%s is making a long space between the prefix and the mentioned variable.

How can I prevent it?

Thanks in advance
pillowCloud is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 05-05-2016 , 22:33   Re: Question about colorchat
Reply With Quote #2

Try this format:

PHP Code:
stock ChatColor(const id, const input[], any:...) 
{
    new 
count 1players32 ]
    static 
msg191 ]
    
vformatmsg190input)
    
format(msg,charsmax(msg),"^4[^1 MyClan ^4]^1: %s",msg)
   
    
replace_allmsg190"!g""^4" )
    
replace_allmsg190"!y""^1" )
    
replace_allmsg190"!t""^3" )

   
    if(
idplayers] = id; else get_playersplayerscount"ch" )
    {
        for(new 
0counti++)
        {
            if( 
is_user_connectedplayers] ) )
            {
                
message_beginMSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players] )  
                
write_byteplayers] )
                
write_stringmsg )
                
message_end( )
            }
        }
    }

^4, ^3 and ^1 too i dont know, add a space i think with E, A and others characters but i dont remember now...
This new stock is the same of your but i recommend to use him, i like
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 05-05-2016 at 22:37.
EFFx is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-06-2016 , 08:28   Re: Question about colorchat
Reply With Quote #3

PHP Code:
static lenlen formatexmsgcharsmaxmsg ), "^4[^1 MyClan ^4]^1 " ); 
Simply remove the space between ^1 and ".
OciXCrom is offline
Send a message via Skype™ to OciXCrom
pillowCloud
Member
Join Date: Aug 2015
Location: AlliedModders
Old 05-06-2016 , 09:34   Re: Question about colorchat
Reply With Quote #4

Quote:
Originally Posted by EFFx View Post
Try this format:

PHP Code:
stock ChatColor(const id, const input[], any:...) 
{
    new 
count 1players32 ]
    static 
msg191 ]
    
vformatmsg190input)
    
format(msg,charsmax(msg),"^4[^1 MyClan ^4]^1: %s",msg)
   
    
replace_allmsg190"!g""^4" )
    
replace_allmsg190"!y""^1" )
    
replace_allmsg190"!t""^3" )

   
    if(
idplayers] = id; else get_playersplayerscount"ch" )
    {
        for(new 
0counti++)
        {
            if( 
is_user_connectedplayers] ) )
            {
                
message_beginMSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players] )  
                
write_byteplayers] )
                
write_stringmsg )
                
message_end( )
            }
        }
    }

^4, ^3 and ^1 too i dont know, add a space i think with E, A and others characters but i dont remember now...
This new stock is the same of your but i recommend to use him, i like
Thank you very much!!

Quote:
Originally Posted by OciXCrom View Post
PHP Code:
static lenlen formatexmsgcharsmaxmsg ), "^4[^1 MyClan ^4]^1 " ); 
Simply remove the space between ^1 and ".
omg.. this shows me how dumb I am
Thanks alot!
pillowCloud is offline
Reply


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

Forum Jump


All times are GMT -4. The time now is 18:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode