Gallery
Info
I think many people have faced the problem of a lack of chat length. We are talking about cases when the output of messages to the chat occurs with the preliminary formatting of the text and the substitution of various information before the text written by the player.
A striking example of this is /r chat, for example, where the output can vary from such [R] *rank* *nickname*[*id*]: text to such [R] *fraction* *department* *rank* *nickname*[*id*]: text. And in such cases, the remaining space for the player's text remains even less than 128 characters, and here you can still count all the HEX colors of the {FFFFFF} format, which are often used in such chats, they also take up space and affect this limit of 144 characters.

To begin with, a little theory. Everyone knows that the maximum length of the text that can be output via SendClientMessage is 144 characters, and the maximum length of the text that the player can enter into the chat is 128 characters, and then it turns out that all these prefixes before the text should not occupy 16 characters, otherwise the player will face such a problem that when when entering text into the chat, the message is simply not sent (in fact, it is sent, but due to the limit of 144 characters, the message is simply not output to the chat)
It seems that the correction of the problem is quite trivial, you can simply handle such cases in the code, tear the string into 2 parts and send it in two parts, but there are several points that will not look very nice, starting from the elementary mismatch of colors in the first and second line (the case when all HEX colors are in the first line and they will not apply to the second one) and ending with the fact that the break point may also fall on the HEX color, thereby breaking the HEX, part of which will remain at the end of the first line, and the other part will be at the beginning of the second line.

After looking at all the available solutions from the public, I realized that, in principle, there are not so many options, and all the available ones have a sufficient number of disadvantages described above, from that moment I decided to make my implementation on the plugin.

What functions are available
- The ability to transfer lines with a break
- The ability to transfer lines with a break with the insertion of a line break pointer (...)
- The ability to transfer lines by separator character (space or any other)
- Any transfer function will use the last HEX color from the last row and apply it to the separated row
- Any hyphenation function will not tear the HEX color if the line break location is somewhere in the middle of the HEX color
- Automatic hooks on SendClientMessage (if you need your own implementation, you can disable it. Details below)

Learn more about the functions
In the inclusion coming with the plugin, there are 5 different defines that you can use depending on your requirements:
SEPARATE_METHOD_DISABLE - Disables all interceptions of the SendClientMessage function, use if you need to implement your interception
SEPARATE_METHOD_AS_IS is a separator that tears lines in the first available place so as not to break the HEX colors, and automatically transfers the HEX to a new line if it was in the last line
SEPARATE_METHOD_GAP is a separator that tears lines in the first available place, but adds marks at the end and beginning of the line in the form (text.../...text.../...text), also does not tear HEX colors and automatically transfers HEX to a new line if it was in the last line
SEPARATE_METHOD_CHAR_MOD_0 is a separator that divides strings by character (space according to the standard), if it does not find a separator character, the SEPARATE_METHOD_AS_IS method will be applied, it also does not tear HEX colors and does color transfer
SEPARATE_METHOD_CHAR_MOD_1 is a separator that divides strings by character (space according to the standard), if it does not find a separator character, the SEPARATE_METHOD_GAP method will be applied, it also does not tear HEX colors and does color transfer, this define is set according to the standard, if any of the above were not used
Author user#377139
Createda year ago
Downloads50
Comments0
Size319 KiB
PriceFree

Please signup or login to comment.

Create your own server!

Continue

More from user#377139

Showing 1-3 of 13 items.

War3Source brings the Warcraft 3 leveling style and races into the game. It is originally based on the amxmodx (AMX) version War3FT.

Each standard...

Author user#377139 Created a year ago Downloads 19 Comments 0 Size 754 KiB Price Free

Plugin to reset your score in CSS/CS:GO with many funny features.

Cvars

Edit this in abner_resetscore.cfg that will automatically created in [cf...

Author user#377139 Created a year ago Downloads 14 Comments 0 Size 22 KiB Price Free

Description
An advanced music player in source engine game.

Features
Broadcast music to all players.
Listen to music yourself.
Real time synchr...

Author user#377139 Created a year ago Downloads 28 Comments 0 Size 3 MiB Price Free