PDA

View Full Version : Colored message


cFG
06-24-2010, 12:40
Hi all,
i used the search function but the answer for my q was not found.

I would like to print a color message from .txt file
For ex. data/lang/timeleft.txtTIME_LEFT = !gTime !tLeftDoesn't work.

So how to?

YamiKaitou
06-24-2010, 19:26
You need to code the function that is printing the message to add the colour. The default plugins are not set to show colour by default

cFG
06-25-2010, 08:15
Guessed! :D
But how does it look?

ColorChat.inl doesn't work on lang files.

Alka
06-25-2010, 08:18
This does -> http://forums.alliedmods.net/showthread.php?p=851160

cFG
06-25-2010, 08:39
Damn.
When i' included the #include <chatcolor.inc> in a *sma file, compiled and... plugin doesn't work.
Plugin status is: unknown.

L 06/25/2010 - 14:37:21: [AMXX] Plugin "timeleft.amxx" failed to load: Module/Library "chatcolor" required for plugin. Check modules.ini.

abdul-rehman
06-25-2010, 08:39
Here is a stock:
// Prints chat in colours
// use !g for green color
// use !t for team color [Team color can be red ,blue or grey, It depends on players team]
// use !y for yellow color
stock client_colored_print(const id, const input[], any:...)
{
new iCount = 1, iPlayers[32]

static szMsg[191]
vformat(szMsg, charsmax(szMsg), input, 3)

replace_all(szMsg, 190, "!g", "^4") // green txt
replace_all(szMsg, 190, "!y", "^1") // orange txt
replace_all(szMsg, 190, "!t", "^3") // team txt

if(id) iPlayers[0] = id
else get_players(iPlayers, iCount, "ch")

for (new i = 0; i < iCount; i++)
{
if (is_user_connected(iPlayers[i]))
{
message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, iPlayers[i])
write_byte(iPlayers[i])
write_string(szMsg)
message_end()
}
}
}

Usage:

client_colored_print( id, "!gHy , !t Bye ")

cFG
06-25-2010, 08:43
abdul-rehman (http://forums.alliedmods.net/member.php?u=66813), i wan't to print colored text by multilingual(txt) files not through plugin.
This method also does not work.

abdul-rehman
06-25-2010, 09:05
Then use conners plugin bcoz it is the best..

cFG
06-25-2010, 09:06
I'll try'd but...


When i' included the #include <chatcolor.inc> in a *sma file, compiled and... plugin doesn't work.
Plugin status is: unknown.

L 06/25/2010 - 14:37:21: [AMXX] Plugin "timeleft.amxx" failed to load: Module/Library "chatcolor" required for plugin. Check modules.ini.

fun
;engine
;fakemeta
;geoip
;sockets
;regex
;nvault
cstrike
csx
;hamsandwich

Hezerf
06-25-2010, 10:13
You need that plugin too.

cFG
06-25-2010, 10:36
Ok, so colorchat.amxx - activated.
timeleft.amxx - activated.
And, when i type: timeleft plugin displays: !gTime !tLeft: [time]In lang file i type'd: TIME_LEFT = !gTime !tLeftWhat i'm doing wrong? :x

DruGzOG
06-25-2010, 10:42
You need that plugin too.


You don't need the plugin.


Make sure the letters in "ColorChat.inc" Made a big difference when I used the include for one of my plugins

cFG
06-25-2010, 10:44
Include is call'd: chatcolor.inc not ChatColor.inc
But anyway, thanks for help.
However, problem persits(post #11).

DruGzOG
06-25-2010, 10:48
Try using the below

cFG
06-25-2010, 10:54
Doesn't work.
God dam! :(
I have no idea how to fix it, rawr!

Alka
06-25-2010, 11:38
OMG, stop it! He want to use colored chat text with MULTILINGUAL support. The only way is tu use Connor's API plugin:
-Install the plugin -> colorchat.sma
-Put the chatcolor.inc in amxmodx/scripting/includes
-In your plugin "#include <chatcolor>"
-For messages use in plugin "timeleft" source -> "client_print_color(...)" - Don't put any signs like "^4, !t, !g" in plugin, instead of "client_print(...)" native from amxx.
-In your multilingual file you can use
In all other files such as multilanguage files, use !g to set following text to green, !n to set following text to normal player chat color (yellow by default), and !t to set following text to the color passed in second argument.

cFG
06-25-2010, 11:52
And now it works!
Thank you so much, i forgive about step number 4 :)

Alka
06-25-2010, 11:53
Ah, no problem, i'm glad it works :-)

ConnorMcLeod
06-25-2010, 12:02
My plugin doesn't work fine with ML in fact, it mixes all ML.
Gonna write a new .inc file some day.

Rohan
01-16-2013, 22:59
OMG, stop it! He want to use colored chat text with MULTILINGUAL support. The only way is tu use Connor's API plugin:
-Install the plugin -> colorchat.sma
-Put the chatcolor.inc in amxmodx/scripting/includes
-In your plugin "#include <chatcolor>"
-For messages use in plugin "timeleft" source -> "client_print_color(...)" - Don't put any signs like "^4, !t, !g" in plugin, instead of "client_print(...)" native from amxx.
-In your multilingual file you can use


Can You Explain Your 4th Step As I Am Too Facing The Same Problem As His In Post#11