Forcing a user cmd on a player at any time?
Forcing a user cmd on a player at any time?
How would I go about forcing a user cmd on a player? For example to force a player to +jump. I know you can change the buttons in a user_cmd in an OnPlayerRunCommand listener to force a player to press a button but how about at any given time?
Re: Forcing a user cmd on a player at any time?
I now see that OnPlayerRunCommand calls even if the player isn't moving. I guess this could work, unless someone has a better solution.
Re: Forcing a user cmd on a player at any time?
Yep, OnPlayerRunCommand is the only possibility.
- L'In20Cible
- Project Leader
- Posts: 1533
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
Re: Forcing a user cmd on a player at any time?
You could also use the m_afButtonForced property. For example:
Would force the player to jump. However, keep in mind that this property is not networked to clients so any button that requires client prediction won't work as intended (for instance, forcing +duck will duck the player on the server but the player's view won't be correctly offseted in his screen, etc.). So yes, depending of what buttons you want to force, OnPlayerRunCommand is the only networked way, like Ayuto said.
Syntax: Select all
player.set_property_int('m_afButtonForced', PlayerButtons.JUMP)
Would force the player to jump. However, keep in mind that this property is not networked to clients so any button that requires client prediction won't work as intended (for instance, forcing +duck will duck the player on the server but the player's view won't be correctly offseted in his screen, etc.). So yes, depending of what buttons you want to force, OnPlayerRunCommand is the only networked way, like Ayuto said.
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 18 guests