Page 1 of 1

ClientCommand working for +lookatweapon but not +jump?

Posted: Tue Dec 28, 2021 7:46 am
by Mahi
Hi, I'll show the code first as it explains the issue immediately:

Syntax: Select all

@ClientCommand('+lookatweapon')
def on_lookatweapon(command, player_index):
print('Yup, works')

@ClientCommand('+jump')
def on_jump(command, player_index):
print('Nope, never gets printed')

For one reason or another, +lookatweapon works as expected but +jump never gets executed.

Why does this happen, and is there a way around it?

Re: ClientCommand working for +lookatweapon but not +jump?

Posted: Tue Dec 28, 2021 8:24 am
by L'In20Cible
Mahi wrote:Why does this happen, and is there a way around it?

Commands that are solely flagged as CLIENTDLL are for the most part not networked from client → server. This is the case for movements and impulses; they are combined using bitwise operators and networked as a single integer once per frame rather than individual inputs. The only way to listen to such commands server-side is to intercept the CUserCmd the clients send over to the server. You can do so using OnButtonStateChanged, OnPlayerRunCommand, or OnPlayerPostRunCommand listeners.

Re: ClientCommand working for +lookatweapon but not +jump?

Posted: Wed Dec 29, 2021 10:00 am
by Mahi
That makes sense, thank you very much once again! :)