English Detect if player is chatting

8 replies
Goto Page
To the start Previous 1 Next To the start
07.03.18 08:00:25 pm
Up
ReVoltage
User
Offline Off
Like the title say, is it possible within CS2D itself?
I know there's a way where if player press Y or U, just made a variable that they are in chat or something.
But the downside is some players got custom binds, which the server cannot do anything about.

If it's not possible currently, can it be a thing?
I was so excited CS2D has custom key bind (because I like to make custom game modes such as RPG), it had so much potential but are limited due to the fact that you cannot detect player chatting.

Thanks in advance..
08.03.18 01:15:38 am
Up
VADemon
User
Offline Off
Theoretically you can auto-detect a player's chat bind after a few sent chat messages because it's always the same key that's used to open chat window.
08.03.18 04:52:50 pm
Up
ReVoltage
User
Offline Off
I think adding a lot of unused keys using addbind will be bad for network, as this page says http://cs2d.com/help.php?hookcat=all&hook=key#hook.

Also, it is not so consistent. It's not worth to do those just for few peoples that changes the chat bind honestly..
08.03.18 07:22:47 pm
Up
DC
Admin
Offline Off
I don't think it's possible to get this working in a reliable/efficient way with the current CS2D version and I do not plan to make any changes related to this.

The problem is that Lua runs on server only and chat input is entirely client-sided. The server doesn't know if any client is currently typing a chat message. It only knows when the final chat message is submitted by the client.

Sure, you could just add a lot of key hooks and assume that someone is chatting when a lot of different keys are used but that's not reliable and extremely inefficient (traffic-wise).
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
08.03.18 09:35:43 pm
Up
ReVoltage
User
Offline Off
Thanks for the clarification!

Too bad that it cannot be implemented easily, but I completely understand.

I would just assume majority of players use default bind for chats, rather than adding a lot of key bindings which is inefficient. Probably would put a warning in the server also..

Again, thanks for the reply
08.03.18 09:54:09 pm
Up
Gaios
Security Supporter
Offline Off
cs2d lua hook key
cs2d lua cmd addbind

...and just bind [Y] button. It's not that big deal with bandwidth..
IMG:https://i.imgur.com/itOslkM.gif
This community is a meme.
09.03.18 01:47:32 am
Up
Vehk
User
Offline Off
@user Gaios:, The problem is that you don't know which key the player has bound for chat.

I think the best thing you can do is assume the default key is being used and give the player an option to change it. Give a message when joining/spawning and maybe have flashing hudtext such as "You have not set your bind key, press (or say) x to change it!" If they're connecting with steam or USGN you should save it for that ID.

Detecting when they exit chat would be easier, but still it's probably not 100% reliable. Obviously, if they send a chat message, they are no longer tying it. You should check for other actions as well, such as: move, attack, usebutton, etc.
09.03.18 05:28:36 am
Up
Mora_rus
User
Offline Off
Maybe you can addbind for most usable keys and then, make a test when on player settings, like:
"Type a message"
And the last pressed button means bind that used for chatting, the message sending means that player sent it and the test is end and the key might be saved in settings.

I dont remember if this bug is fixed or not(when you're on chat and you clicking addbinded keys they would work meanwhile).
09.03.18 02:22:36 pm
Up
ReVoltage
User
Offline Off
@user Gaios: I know that, but not everyone has default bind. I mention that in the post. Probably should read the problem carefully, don't you think?

I think I would avoid those possible ways because simply they are not efficient and not worth by adding a lot of not really used keys to addbinds. The only way now is avoiding addbinds for alphabets and just go for F6, F7, F8, etc.

Thank you everyone for the solution!
To the start Previous 1 Next To the start