Raised This Month: $12 Target: $400
 3% 

Solved client_print_color | It does not work properly


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wilianmaique
BANNED
Join Date: Nov 2016
Old 06-16-2019 , 16:36   client_print_color | It does not work properly
Reply With Quote #1

I'm using it this way, but the color is not changed.


PHP Code:
new prefixchat[20
Register:
PHP Code:
myvar create_cvar("my_prefix""^4[PREFIX]"
Pulling:
PHP Code:
get_pcvar_string(myvarprefixchatcharsmax(prefixchat))
client_print_color(0print_team_default"%s"prefixchat
If I change the color inside the game does not work.

Except if I use this stock

PHP Code:
stock xClientPrintColor(const id, const input[], any:...)
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4")
    
replace_all(msg190"!y""^1")
    
replace_all(msg190"!t""^3")
    
replace_all(msg190"!t2""^0")
    
    if (
idplayers[0] = id; else get_players(playerscount"ch")

    for (new 
0counti++)
    {
        if (
is_user_connected(players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
            
write_byte(players[i])
            
write_string(msg)
            
message_end()
        }
    }

Instead of: ^1 ^2 ^3 etc
Use: !g !t !y

Last edited by wilianmaique; 06-17-2019 at 17:46. Reason: Solved
wilianmaique is offline
Send a message via Skype™ to wilianmaique
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 06-16-2019 , 16:53   Re: client_print_color | It does not work properly
Reply With Quote #2

^ is a control character, it's not a literal "^4" but an ASCII character with byte code of 4.
It would be pretty inconvenient for the user to write  into a CVAR.
__________________

Last edited by <VeCo>; 06-16-2019 at 16:55.
<VeCo> is offline
thEsp
BANNED
Join Date: Aug 2017
Old 06-16-2019 , 17:24   Re: client_print_color | It does not work properly
Reply With Quote #3

PHP Code:
#pragma ctrlchar '\' // Changes escape character 
Or
Quote:
Originally Posted by fysiks View Post
You need to escape the escape character.

"^^"
thEsp is offline
wilianmaique
BANNED
Join Date: Nov 2016
Old 06-16-2019 , 17:38   Re: client_print_color | It does not work properly
Reply With Quote #4

Quote:
Originally Posted by <VeCo> View Post
^ is a control character, it's not a literal "^4" but an ASCII character with byte code of 4.
It would be pretty inconvenient for the user to write  into a CVAR.
How do I make the color prefix work by using: client_print_color?

Quote:
Originally Posted by thEsp View Post
PHP Code:
#pragma ctrlchar '\' // Changes escape character 
Or
Did not work
wilianmaique is offline
Send a message via Skype™ to wilianmaique
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 06-17-2019 , 10:03   Re: client_print_color | It does not work properly
Reply With Quote #5

Quote:
Originally Posted by wilianmaique View Post
How do I make the color prefix work by using: client_print_color
The same way as the stock you've used.
Replace "^^4" with "^4" in prefixchat. That way you can write "^4" in the CVAR and it will be treated as the special character.
__________________
<VeCo> is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 06-17-2019 , 14:00   Re: client_print_color | It does not work properly
Reply With Quote #6

Or keep it out of the cvar, that is if you always want that color and only want to change the text of the prefix.

PHP Code:
myvar create_cvar("my_prefix""[PREFIX]"
PHP Code:
get_pcvar_string(myvarprefixchatcharsmax(prefixchat))
client_print_color(0print_team_default"^4%s"prefixchat
__________________
Black Rose is offline
wilianmaique
BANNED
Join Date: Nov 2016
Old 06-17-2019 , 17:46   Re: client_print_color | It does not work properly
Reply With Quote #7

Quote:
Originally Posted by <VeCo> View Post
The same way as the stock you've used.
Replace "^^4" with "^4" in prefixchat. That way you can write "^4" in the CVAR and it will be treated as the special character.
Thanks
wilianmaique is offline
Send a message via Skype™ to wilianmaique
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 07:08.


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