ClientCommand working for +lookatweapon but not +jump?

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
Mahi
Senior Member
Posts: 236
Joined: Wed Aug 29, 2012 8:39 pm
Location: Finland

ClientCommand working for +lookatweapon but not +jump?

Postby Mahi » Tue Dec 28, 2021 7:46 am

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?
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

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

Postby L'In20Cible » Tue Dec 28, 2021 8:24 am

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.
User avatar
Mahi
Senior Member
Posts: 236
Joined: Wed Aug 29, 2012 8:39 pm
Location: Finland

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

Postby Mahi » Wed Dec 29, 2021 10:00 am

That makes sense, thank you very much once again! :)

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 22 guests