Raised This Month: $12 Target: $400
 3% 

[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 , 17: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, 17969 views)
File Type: sma Get Plugin or Get Source (colorchat.sma - 14353 views - 6.1 KB)
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 10-14-2013 at 03:03.
ConnorMcLeod is offline
AcidoX
Senior Member
Join Date: Oct 2007
Location: Vilnius
Old 06-17-2009 , 17: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 , 00: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 , 00: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 -

- my plugins -
ConnorMcLeod is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-18-2009 , 01: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 , 01: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 -

- my plugins -

Last edited by ConnorMcLeod; 01-31-2011 at 02:13.
ConnorMcLeod is offline
Guille3mette
BANNED
Join Date: Jul 2013
Old 07-04-2013 , 03:35   Re: Native : ColorChat
Reply With Quote #7

I think I will finally start using colorchat now

Last edited by Guille3mette; 07-04-2013 at 03:35.
Guille3mette is offline
kNowo
Senior Member
Join Date: Apr 2011
Location: Malaysia
Old 07-04-2013 , 09:55   Re: [Dyn Native] ColorChat v0.3.1 (04 jul 2013)
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
Use the player id for the first and second arguments.
I would like to send to all(index= 0) and usign your method would require me to loop all the players and send client_print_color to each of them and use their index as sender param first instead of "client_print_color(0, DontChange, ..."

Quote:
Originally Posted by ConnorMcLeod View Post
I've just edited, pass player index (as fysiks said) or 0 (0 was not supported in previous version).

So now you can use client_print_color(0, 0, ... so players gonna see their own team color.

And for specific player, was already working as client_print_color(id, id, ...) but know you can do client_print_color(id, 0, ...) it is the same.
Nice. Another thing is, if the sender is in unassigned team, what would the color be? Normal or Grey?

EDIT: It's not working:

PHP Code:
client_print_color(00"^3Should me by team color. ^1Should be normal color"
Attached Thumbnails
Click image for larger version

Name:	untitled.jpg
Views:	283
Size:	9.7 KB
ID:	122121  

Last edited by kNowo; 07-04-2013 at 10:13.
kNowo is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-04-2013 , 12:46   Re: [Dyn Native] ColorChat v0.3.2 (04 jul 2013)
Reply With Quote #9

Yes, a case i hadn't think, fixed.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
senecas
Senior Member
Join Date: Jun 2006
Old 06-18-2009 , 02:56   Re: Native : ColorChat
Reply With Quote #10

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


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