Raised This Month: $174 Target: $400
 43% 

[Dyn Native] ColorChat v0.3.2 (04 jul 2013)


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Technical/Development        Approver:   Hawk552 (427)
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-17-2009 , 18:49   [Dyn Native] ColorChat v0.3.2 (04 jul 2013)
Reply With Quote #1

Note that this has been integrated to amxx 1.8.3 core since build 185
Usage here : https://forums.alliedmods.net/showpo...&postcount=232

ColorChat Native




.: Description :.


Colorchat native that can be used by any plugin.

Pro : Instead of using colorchat include that duplicate code in every single plugin in which you use it, use a single plugin to handle colorchat.
Con : Should be a little slower than include, but as you don't plain to send it 1000 times per second, it's not a big deal.

Note : supports ML.



.: Natives :.
  • client_print_color(index, sender, const fmt[], any:...)
  • register_dictionary_colored(const filename[])
    Same as register_dictionary, but transform !g, !t and !n into colors code
    so you can use same ML Keys in normal chat or hudmessage or whereever you want


.: How to use ? :.


You have to start each text with ^4 or ^3 or ^2 or ^1 (or !t, !g, !n in ML files).

In .sma, use ^4 to display green, ^1 to display normal color (yellow by default), and ^3 to display the specified color (2nd arg).
In 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.

Colors for second arg are : a_player_index (use the specified player team color), Red, Blue and Grey.
Those color are applied by ^3 or !t tag.

I've added support for ColorChat stock, all you have to do is to replace at the top of .sma the line :
Code:
#include <colorchat>

with
Code:
#include <chatcolor>



.: Use Example :.


default adminchat edited to use color : http://forums.alliedmods.net/showthr...730#post851730

[img]http://img35.**************/img35/6019/bkzaztecbhop0008.png[/img]




.: Credits :.


Quim, Reymon, Stupok.



__________________
.: Stock Version :.

DON'T USE STOCK VERSION, SEEMS TO HAVE PROBLEM WITH ML Thanks to Nextra who found my mistake, it should works fine now.
If you prefer to use a stock version that doesn't need an extra plugin to work, follow the following link :> Here <




__________________
.: Module Version :.


If you prefer to use a module version, real native is faster, follow the following link :Module Version




__________________
Attached Files
File Type: inc chatcolor.inc (1.9 KB, 13970 views)
File Type: sma Get Plugin or Get Source (colorchat.sma - 10646 views - 6.1 KB)
__________________
- tired and retired -

Last edited by ConnorMcLeod; 10-14-2013 at 04:03.
ConnorMcLeod is offline
AcidoX
Senior Member
Join Date: Oct 2007
Location: Vilnius
Old 06-17-2009 , 18:53   Re: Native : ColorChat
Reply With Quote #2

Nice work man!
__________________
Who need lockerz invite? Pm me.
AcidoX is offline
Send a message via Skype™ to AcidoX
stupok
Veteran Member
Join Date: Feb 2006
Old 06-18-2009 , 01:50   Re: Native : ColorChat
Reply With Quote #3

Rockin'!

I think I will finally start using colorchat now

It looks great, I just noticed two things:

Quote:
Colors for second arg are : DontChange (let original player team color), Red, Green Blue and Grey.
Code:
while( replace() )
->
replace_all()
Knowing your attention to detail, there is probably a good reason to use while() instead of replace_all().
__________________
stupok is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-18-2009 , 01:56   Re: Native : ColorChat
Reply With Quote #4

Thanks for the blue color

Was first using replace_all, but that one check in every loop if string contain 'what[]', store position in string and check is there is enough place left to replace (+ this stock fails as you can get errors with it when you don't set good len params...). Since i'm replacing 2 chars with 2 chars, there shouldn't be any place problem. There could be a better stock though.
From what i've tried, pass directly ^3 or ^4 in calling native works, but from what i remember when was using color chat in the past, some times when multi formating, it is altered, i haven't made enough tests yet to know if this replace stuff can be removed, gonna try to put ^4 in ML keys to see what happen.
__________________
- tired and retired -
ConnorMcLeod is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-18-2009 , 02:02   Re: Native : ColorChat
Reply With Quote #5

The problem with "^4" or the others in the ML is that it doesn't read '^' as the escape character. It reads it as "^^4".
So, you can do it with "!g" or "^4" or whatever you prefer, but you will need to end up using replace() to fix it.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-18-2009 , 02:08   Re: Native : ColorChat
Reply With Quote #6

Quote:
Originally Posted by Exolent[jNr] View Post
The problem with "^4" or the others in the ML is that it doesn't read '^' as the escape character. It reads it as "^^4".
Ok, so the problem is with ML, so, i keep that !g code stuff, gonna just use ^4 in strings where ML is not used.

[EDIT]

!g code replacement is now only for ML and is proceeded at map start.
__________________
- tired and retired -

Last edited by ConnorMcLeod; 01-31-2011 at 03:13.
ConnorMcLeod is offline
senecas
Senior Member
Join Date: Jun 2006
Old 06-18-2009 , 03:56   Re: Native : ColorChat
Reply With Quote #7

this may come into conflict with Zombie_plague code.

cuz of " Send_TeamInfo(id, MSG_ONE_UNRELIABLE, g_szTeamName[iColor]) "
user's team on scoreboard will be screwed up when we use GREY(or RED, BLUE, too)
senecas is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 06-18-2009 , 06:36   Re: Native : ColorChat
Reply With Quote #8

that i understand... i have to add !t !g and/or !n into the .sma of my plugins right?

good plugin i think...

and one more question...

its posible to force a color like "red, blue or grey"? for example i want to put a red message for TTs, CTs, and SPECS too...

its posible?
Alucard^ is offline
Send a message via Skype™ to Alucard^
crazyeffect
Veteran Member
Join Date: Jul 2008
Location: Belgium
Old 06-18-2009 , 07:11   Re: Native : ColorChat
Reply With Quote #9

C... C... Cool!
__________________
crazyeffect is offline
Send a message via MSN to crazyeffect
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-18-2009 , 08:07   Re: Native : ColorChat
Reply With Quote #10

Quote:
Originally Posted by Alucard^ View Post
that i understand... i have to add !t !g and/or !n into the .sma of my plugins right?
You [edit]canHAVE TO[/edit] directly pass ^1, ^3 and ^4 in .sma. In other files as ML files you have to use !g etc..

Quote:
Originally Posted by Alucard^ View Post
its posible to force a color like "red, blue or grey"? for example i want to put a red message for TTs, CTs, and SPECS too...

its posible?
Yes, just pass the color you want, and then use !t.
Color will be user team color if you specify player id + use color = DontChange.
__________________
- tired and retired -

Last edited by ConnorMcLeod; 01-31-2011 at 03:11.
ConnorMcLeod is offline
Reply


Thread Tools
Display Modes

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 05:53.


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