AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Solved]Different colors in client_print from ML file (https://forums.alliedmods.net/showthread.php?t=107322)

micke1101 10-25-2009 08:21

[Solved]Different colors in client_print from ML file
 
Well im trying to write out a text using client_print (maybe have to use a custom one if ive understood it right) and text comes from a ML file but im not sure how to do so for example half the text is green and one word is team colored and the last one yellow (default)
Id appreciate a hint in the right direction :)

and my test code:mrgreen:

Code:
#include <amxmodx> public plugin_init() {     register_plugin("colorchattest", "0.1", "Micke1101")     register_dictionary("colorchattest.txt");     register_logevent("round_start", 2, "1=Round_Start"); } public round_start(){     for ( new i = 1; i <= get_playersnum(); i++ ) {             client_print(id, print_chat, "%L", LANG_PLAYER, "GOOD_LUCK", i);     } }



Quote:

Originally Posted by test.txt
[en]
GOOD_LUCK = "Good luck %s wishes Micke1101"

[sv]
GOOD_LUCK = "Lycka till %s 'o'nskar Micke1101"

will update the code if someone may need it.

Arkshine 10-25-2009 08:31

Re: Different colors in client_print from ML file
 
See ColorChat.

micke1101 10-25-2009 08:52

Re: Different colors in client_print from ML file
 
Thank you, wonder why that one didnt come up when i searched for color anyways it dosent seem to have the ML coloring ability im looking for


edited with the code i was looking for

Code:
#include <amxmodx> new saytext_msgid public plugin_init() {         register_plugin("colorchattest", "0.1", "Micke1101")         register_dictionary("colorchattest.txt");         saytext_msgid = get_user_msgid("SayText")         register_logevent("round_start", 2, "1=Round_Start"); } public round_start(){     for ( new i = 1; i <= get_playersnum(); i++ ) {         new temp[128]         formatex( temp, 127, "%L", LANG_PLAYER, "GOOD_LUCK", i);         replace_all(temp,127,"!n","^x01")         replace_all(temp,127,"!t","^x03")         replace_all(temp,127,"!g","^x04")         message_begin(MSG_ONE,saytext_msgid,{0,0,0},i)         write_byte(i)         write_string(temp)         message_end()     } }


Quote:

Originally Posted by colorchattest.txt
[en]
GOOD_LUCK = "!gGood luck !t%s !nwishes Micke1101"

[sv]
GOOD_LUCK = "!gLycka till !t%s !n'o'nskar Micke1101"

The output will be Good luck (in green)
the players id in team color
and wishes Micke1101 in normal yellow


All times are GMT -4. The time now is 17:33.

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