[INC] CromChat - a better ColorChat!
5 Attachment(s)
---------- [ Description ] ---------- NOTE: as of March 2021 (version 3.0), CromChat is longer Counter-Strike dependant! You can use it it any mod, but the colors will be active only in CS. Since every colorchat include that I used so far had something that I don't like, I decided to make one my self and fix the things that annoy me. For example, I didn't like using RED/BLUE/TEAM_COLOR as a parameter in the ColorChat include, another include displayed an error when sending a message in an empty server, and so on. So, here's my version. ---------- [ Color Codes ] ---------- Beside the default symbols - ^x04, ^x03 & ^x01, you can also use these ones: &x07 = red &x06 = blue &x05 = white &x04 = green &x03 = team color &x01 = normal &x00 = removes message prefix (only if put in the beginning of the message) You can use only one of the following in a single message: &x07, &x06, &x05, &x03. If you use more than one in a message, it will automatically select the color that is first in the list and will replace all other colors with that one. Combining more than one team color is not possible in CS 1.6!!! You can choose from multiple color code groups by adding a single line in the .sma file. You can see all the different groups on the image below. By default, the CROMCHAT group is used. https://raw.githubusercontent.com/Oc...ter/colors.png To activate a different color group, simply add #define CC_COLORS_TYPE CC_COLORS_<group name> before #include <cromchat>. Example: if you want to activate the group SHORT, the code needs to look like this: PHP Code:
You can also make your own custom set of codes, by using the group CUSTOM like this: PHP Code:
---------- [ Sending Messages ] ---------- Messages are sent using the function CC_SendMessage or CromChat: PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
You can also change the color for any other CC_* function by using CC_SetColor. This will force the next CC_* call to use that color. PHP Code:
You can prevent this by setting the second parameter to true: PHP Code:
---------- [ Adding A Prefix ] ---------- With the function CC_SetPrefix you can specify a global prefix that will automatically be added in the beginning of each message. This is much more easier than having to add a prefix manually on each line of code. The function needs to be added in plugin_init() (or some other forward if necessary). PHP Code:
---------- [ Removing Colors ] ---------- To remove the color codes from a message: PHP Code:
If bMenu = true, it will remove the codes for menu colors. There is also a function for removing chat exploits, e.g. chat color codes and the % sign. PHP Code:
---------- [ View the API ] ---------- ---------- [ Download ] ---------- |
Re: [INC] CromChat
If we are on this let's break that horrible design which is present in almost every colorchat. Have a custom function to send the message and separat the single-player case from the array so you don't have to call is_user_connected for nothing.
PHP Code:
|
Re: [INC] CromChat
With this you can't write just "!g" (without coloring), so you can replace "!!" with "!", but this would break phrases with "!!!", better to use something that is rarely used, like {}, so you can use it as "{g}", "{r}", etc. Or with full color naming "{green}", "{red}", etc.
static szMessage[192] this can lead server crash, if string would have 191 length. You should use 192 - 1 (for write_byte) = 191. You can reserve TeamInfos for TR, CT and SPECTATOR on high-slots like 33-35 or 61-63 or 49-51, etc. PHP Code:
PHP Code:
Also why is it unreliable? And also it doesn't support ML for sending to all players. See my ChatPrint |
Re: [INC] CromChat
I agree with {green} and {red}, will be much better.
|
Re: [INC] CromChat
Sorry for the late answer, I was a little busy today.
So, here's what I did so far:
About the color symbols - they are not that much used in normal messages, but when I think about it, a player's nickname can easily contain them on purpose or not. Is it possible to use symbols such as ^7, ^6, etc? I tried doing it, but it showed a blank space in the chat. Any way to make them replaceable inside the code? I know they can't be manually added in chat, so this would be the most safe way to do it. {green} style is way too long. By the way, is it possible to add a parameter after "any:..."? By the way 2 - what's the difference between MSG_ONE and MSG_ONE_UNRELIABLE? Which one should I use? PHP Code:
|
Re: [INC] CromChat
Quote:
Quote:
Quote:
PHP Code:
Quote:
Quote:
Quote:
Quote:
|
Re: [INC] CromChat
w0w @OciXCrom
|
Re: [INC] CromChat
@OciXCrom bro can u add ^4 for Green ^3 for TeamColor ^1 for Normal ^5Red ^6Blue ^2 for White :P ??
what u think?? |
Re: [INC] CromChat
Quote:
|
Re: [INC] CromChat
@shehzad1234 - I think you should read all previous comments before suggesting it. :bee:
I updated the file in the first post and I think it's ready now. I changed the color symbols from !g to &x04. I don't want to use ^x04 style because this one can't be used inside ML/cfg/ini files. So I think the current one is the best solution. &x07 = red &x06 = blue &x05 = white &x04 = green &x03 = team color &x01 = normal I also improved one more thing that bugged me - when I want to send a chat message and log it at the same time, I had to replace all color symbols in order to do it. So, I added CC_LogMessage, which will simultaneously send a chat message and log it. |
Re: [INC] CromChat
Quote:
|
Re: [INC] CromChat
@OciXCrom can u replace
&x06 with ^6 only its easy |
Re: [INC] CromChat
It's not easy at all and if you read the comments (again), you will see why.
|
Re: [INC] CromChat
ok bro :D
|
Re: [INC] CromChat
I added CC_RemoveColors function whicih will remove all chat and (or) menu colors from a message.
I also added a way to send a message without the prefix. Simply add &x00 in the beginning. |
Re: [INC] CromChat
hmm bro :)
|
Re: [INC] CromChat
Added CC_SendMatched(id, iPlayer, szMessage[], any:...)
With this you can send a message that matches iPlayer's team color or use one of thee color arguments instead of a player id - CC_COLOR_[RED|BLUE|GREY|DEFAULT]. If a different color code is found in the message itself, it will switch to that color. |
Re: [INC] CromChat
https://img.shields.io/badge/update-v1.3-green.svg
|
Re: [INC] CromChat
https://img.shields.io/badge/update-v1.4-green.svg
|
Re: [INC] CromChat
OciXCrom Thanks a lot for adding support to ColorChat, Now we don't need to replace each and every print chat with CromChat
|
Re: [INC] CromChat - a better ColorChat!
https://img.shields.io/badge/update-...2018-green.svg
|
Re: [INC] CromChat - a better ColorChat!
Quote:
wher is sma and amxx ?? |
Re: [INC] CromChat - a better ColorChat!
Was it really necessary to quote the entire first post?!
Also, what are you talking about? This is not a plugin. |
Re: [INC] CromChat - a better ColorChat!
Can you explain how can I remove the prefix on some messages with the &x00?
|
Re: [INC] CromChat - a better ColorChat!
By putting it in the beginning of the message:
PHP Code:
|
Re: [INC] CromChat - a better ColorChat!
I'm using CC_SendMatched:
PHP Code:
|
Re: [INC] CromChat - a better ColorChat!
Hm, indeed it doesn't work with CC_SendMatched. I'll have a look. For now you can create a custom function that will send a message without a prefix.
PHP Code:
|
Re: [INC] CromChat - a better ColorChat!
That's what I thinked to do before, remove the prefix, send the message and then set the prefix again, so I don't need to use this stock. However, i'll wait the update, maybe you'll think in a better way.
|
Re: [INC] CromChat - a better ColorChat!
https://img.shields.io/badge/update-...2018-green.svg
|
Re: [INC] CromChat - a better ColorChat!
I added & x00 before the message in CC_SendMatched (blablabla), however did not remove the prefix ...
|
Re: [INC] CromChat - a better ColorChat!
Ah, yeah, I forgot about that problem. It won't work with CC_SendMatched for some reason. You can remove the prefix with CC_RemovePrefix and set it again if you're going to use CC_SendMatched. The &x00 was originally designed for CC_SendMessage.
|
Re: [INC] CromChat - a better ColorChat!
Quote:
|
Re: [INC] CromChat - a better ColorChat!
https://img.shields.io/badge/update-...2018-green.svg
|
Re: [INC] CromChat - a better ColorChat!
When will you add &x00 format to CC_SendMatched?
|
Re: [INC] CromChat - a better ColorChat!
Quote:
|
Re: [INC] CromChat - a better ColorChat!
Ty
|
Re: [INC] CromChat - a better ColorChat!
that's great, helpful
|
Re: [INC] CromChat - a better ColorChat!
tags not working
|
Re: [INC] CromChat - a better ColorChat!
Quote:
|
Re: [INC] CromChat - a better ColorChat!
Is possible add another color, like purple?
|
All times are GMT -4. The time now is 20:20. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.