Raised This Month: $ Target: $400
 0% 

text colors doesn't work...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
reinert
Veteran Member
Join Date: Feb 2007
Old 01-08-2011 , 12:18   text colors doesn't work...
Reply With Quote #1

Hey, why the hell I can't get working text colors...

PHP Code:
client_print(idprint_chat"^x04Hello ^x03My ^x01Friends"
should be:



but the output is something like:

Hello My Friends, note that the spaces are multiplied :/

BTW I don't need ColorChat or other client_printcolor ...
reinert is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-08-2011 , 12:32   Re: text colors doesn't work...
Reply With Quote #2

You can't print colors with default amxx natives, you have to use my colorchat plugin, or any colorchat include, or to make your own code into your plugins.

If you don't need colorchange, and if you don't need ML support with id=0 and LANG_PLAYER, then you can use this simple stock :

PHP Code:
colorchat_simple(id, const fmt[], any:...)
{
    static 
iMsgSayText
    
if( !iMsgSayText )
    {
        
iMsgSayText get_user_msgid("SayText")
    }
    new 
szMessage[192]
    
vformat(szMessagecharsmax(szMessage), fmt3)
    
message_begin(id MSG_ONE_UNRELIABLE MSG_BROADCASTiMsgSayText, .player=id)
    
write_byte(id id 1)
    
write_string(szMessage)
    
message_end()

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 01-08-2011 at 13:27.
ConnorMcLeod is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 01-08-2011 , 12:38   Re: text colors doesn't work...
Reply With Quote #3

Yeah thanks, also I've another stock client_printc (you should know, with \g \t \n...) But I wan't to make a explanation how to use colors of client_printc, so I can't same color codes into output :S)

Also 1 more question, how to copy string from one array to other...

PHP Code:
copy(String2[id][255], 255String1[id][255]);
replace_all(String2[id][255], 255"x*"""
Doesn't work

EDIT 2: also your code this line:
PHP Code:
message_begin(id MSG_ONE_UNRELIABLE MSG_BROADCASTiMsgSayTextid); 
has error, that argument type mismatch (3rd argument, the problem is in "id" ..)

Last edited by reinert; 01-08-2011 at 12:41.
reinert is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-08-2011 , 13:29   Re: text colors doesn't work...
Reply With Quote #4

Fixed 3rd argument error.
Also, !g !n and !t are only needed if you use strings from a .txt file such as dictionary file, but you can directly put color codes into them, instead of ^4, with notepad++ type Alt + 04 so you can use 01 03 and 04.

Try :
copy(String2[id], 255, String1[id]);
replace_all(String2[id], 255, "x*", "")
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 01-08-2011 , 16:00   Re: text colors doesn't work...
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
Try :
copy(String2[id], 255, String1[id]);
replace_all(String2[id], 255, "x*", "")
Nope, still doesn't work, the output is empty :S
reinert is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-08-2011 , 16:08   Re: text colors doesn't work...
Reply With Quote #6

May be input is empty.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 01-08-2011 , 16:27   Re: text colors doesn't work...
Reply With Quote #7

I don't think so, because String1 is not empty..
reinert is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-08-2011 , 16:40   Re: text colors doesn't work...
Reply With Quote #8

String1 is input string, String2 is output string.

I say : maybe input is empty, you answer : no because input is not empty.

May be you could show more code, or whole code.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 01-08-2011 , 16:45   Re: text colors doesn't work...
Reply With Quote #9

when I'm trying to print the String1 it prints everything okay...

Quote:
client_print(0, print_chat, "%s", String1[id][255])
but when I'm trying to copy the String1 to String2, and replace the "x*" to "" in String2, and then print it, it shows me nothing ...
reinert is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-08-2011 , 16:48   Re: text colors doesn't work...
Reply With Quote #10

Please show at least every code that uses String1 and String2,also declarations.
Whole code would be better.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 02:13.


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