AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   text colors doesn't work... (https://forums.alliedmods.net/showthread.php?t=147374)

reinert 01-08-2011 12:18

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

PHP Code:

client_print(idprint_chat"^x04Hello ^x03My ^x01Friends"

should be:
http://www.part.lt/img/13000e93b826e...6f68c06581.jpg
http://www.part.lt/img/13000e93b826e...6f68c06581.jpg

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 ...

ConnorMcLeod 01-08-2011 12:32

Re: text colors doesn't work...
 
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()



reinert 01-08-2011 12:38

Re: text colors doesn't work...
 
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" ..)

ConnorMcLeod 01-08-2011 13:29

Re: text colors doesn't work...
 
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*", "")

reinert 01-08-2011 16:00

Re: text colors doesn't work...
 
Quote:

Originally Posted by ConnorMcLeod (Post 1389140)
Try :
copy(String2[id], 255, String1[id]);
replace_all(String2[id], 255, "x*", "")

Nope, still doesn't work, the output is empty :S

ConnorMcLeod 01-08-2011 16:08

Re: text colors doesn't work...
 
May be input is empty.

reinert 01-08-2011 16:27

Re: text colors doesn't work...
 
I don't think so, because String1 is not empty..

ConnorMcLeod 01-08-2011 16:40

Re: text colors doesn't work...
 
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.

reinert 01-08-2011 16:45

Re: text colors doesn't work...
 
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 ...

ConnorMcLeod 01-08-2011 16:48

Re: text colors doesn't work...
 
Please show at least every code that uses String1 and String2,also declarations.
Whole code would be better.


All times are GMT -4. The time now is 02:13.

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