Raised This Month: $ Target: $400
 0% 

Colored text


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
asdff
Junior Member
Join Date: Jun 2009
Old 02-17-2011 , 14:48   Colored text
Reply With Quote #1

Hello,
Can anyone tell me how to post a text on chat that contains a colored segment in the message?
Something like this:
For unban, post the screenshots on www.forumname.com
I would like to use this function
Code:
client_print(player, print_chat, "For unban, post the screenshots on %s", forum)
Thank you!
asdff is offline
AfteR.
Veteran Member
Join Date: Dec 2008
Location: λ
Old 02-17-2011 , 15:00   Re: Colored text
Reply With Quote #2

PHP Code:
// Code...

ChatColor(id"For unban, post the screenshots on !team%s"forum)


stock ChatColor(const id, const input[], any:...)
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4"// Green Color
    
replace_all(msg190"!y""^1"// Default Color
    
replace_all(msg190"!team""^3"// Team Color
    
replace_all(msg190"!team2""^0"// Team2 Color
    
    
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();
            }
        }
    
    }

AfteR. is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-17-2011 , 15:15   Re: Colored text
Reply With Quote #3

Horrible stock, contains errors.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 02-17-2011 , 15:31   Re: Colored text
Reply With Quote #4

I AGREE
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
asdff
Junior Member
Join Date: Jun 2009
Old 02-17-2011 , 15:39   Re: Colored text
Reply With Quote #5

Not working
Any other option?
asdff is offline
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 02-17-2011 , 15:45   Re: Colored text
Reply With Quote #6

Best way
PHP Code:
stock print_color(const id, const input[], any:...)
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg,190,input,3)
    
replace_all(msg,190,"/g","^4");// green txt
    
replace_all(msg,190,"/y","^1");// orange txt
    
replace_all(msg,190,"/ctr","^3");// team txt
    
replace_all(msg,190,"/w","^2");// team txt
    
if (idplayers[0] = id; else get_players(players,count,"ch")
    for (new 
i=0;i<count;i++)
        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()
        }

Works fine, but I'm not sure about "/w" :/ I suspect it.
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-17-2011 , 15:53   Re: Colored text
Reply With Quote #7

Horrible.

Tired to see suck stock, gonna write stock version of colorchat native.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 02-17-2011 , 17:18   Re: Colored text
Reply With Quote #8

You're horrible, stock is good.
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-17-2011 , 17:37   Re: Colored text
Reply With Quote #9

Then tell me why :

You loop through all player instead of sending a broadcast message when id = 0.
You check if players are connected when you loop through get_player list.
You don't cache msg index value.
You use those /g keys when ^4 can directly be passed.

?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Stressful
Senior Member
Join Date: Feb 2011
Old 02-18-2011 , 00:59   Re: Colored text
Reply With Quote #10

Maybe you can try this ? A simpler way?
PHP Code:
client_print(playerprint_chat"For unban, post the screenshots on %s"forum
--------------->
PHP Code:
#include <colorchat>
ColorChat(idNORMAL"For unban, post the screenshots on %s"forum
PHP Code:
^x04 / ^Green color text
^x03 or ^Team color 
Example
ColorChat(idNORMAL"For ^x04 unban^x01, post ^x03 the screenshots^x01 on %s"forum
Add a "^x01" @ the back too.
__________________
Stressful is offline
Reply



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 19:57.


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