View Single Post
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 03-15-2017 , 16:36   Re: [INC] CromChat
Reply With Quote #6

Quote:
Originally Posted by OciXCrom View Post
I changed szMessage to have 191 characters.
I prevented the localized strings and %s bugs.
Quote:
Originally Posted by PRoSToTeM@ View Post
And szMessage size now should be 192 - 1 (for write_byte) - 3 (for write_string("%s")) = 188.
Quote:
Originally Posted by OciXCrom View Post
Another thing that bugged me was having to add the prefix manually every time. I added a stock which can be used to add a prefix to the messages with one single line in plugin_init() (or anywhere else).
It can be done via macro:
PHP Code:
#defined PrefixedCromChat(%0,%1,%2) CromChat(%0, fmt("%s %s", YourPrefix, %1), %2) 
Quote:
Originally Posted by OciXCrom View Post
I made a sepparate function to send the message. Another issue that was present in the other includes, when sending a message to all players at once, the team color sometimes wasn't correct. What's happening is - when I send a message with some color, it keeps that color until the player receives the TeamInfo message again. For that problem I added a function that will reset the TeamInfo message for all players when sending it to everyone, but this includes two sepparate loops - should I keep it this way or should I not use MSG_ALL and use a loop for everyone?
There is a problem with your TeamInfo sending: you should restore it, but it isn't always trivial, because some plugins can change TeamInfo without changing actual team. You can't use MSG_ALL for SayText here, it would break ML support at all. You also can't use MSG_ALL for TeamInfo here, because MSG_ALL messages are sent after all MSG_ONE messages. (MSG_BROADCAST after MSG_ONE_UNRELIABLE too, order of MSG_ONE and MSG_ONE_UNRELIABLE messages is unstable)
Quote:
Originally Posted by OciXCrom View Post
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.
You can create escape function for this as I created for my ChatPrint - ChatPrint_EscapeString. But I think better and simpler (for user of your API) to read colors only from format string (including ML formats too), but this requires some untrivial workaround. 01, 02, 03, ... codes are also safe, because name can't contain it, but chat messages which are sent via "say" can contain them, so...
Quote:
Originally Posted by OciXCrom View Post
{green} style is way too long.
You can make code that would support both {g} and {green}.
Quote:
Originally Posted by OciXCrom View Post
By the way 2 - what's the difference between MSG_ONE and MSG_ONE_UNRELIABLE? Which one should I use?
In most cases you should use reliable channel - MSG_ONE and MSG_ALL, but in most temp entity messages you should use unreliable channel.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@