[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. |
All times are GMT -4. The time now is 07:31. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.