Forum

> > CS2D > Scripts > Detect if player is chatting
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Detect if player is chatting

8 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Detect if player is chatting

ReVoltage
User Off Offline

Zitieren
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..

alt Re: Detect if player is chatting

VADemon
User Off Offline

Zitieren
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.

alt Re: Detect if player is chatting

DC
Admin On Online

Zitieren
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).

alt Re: Detect if player is chatting

ReVoltage
User Off Offline

Zitieren
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

alt Re: Detect if player is chatting

Vehk
User Off Offline

Zitieren
@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.

alt Re: Detect if player is chatting

Mora
User Off Offline

Zitieren
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).

alt Re: Detect if player is chatting

ReVoltage
User Off Offline

Zitieren
@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!
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht