So, basically, the subject.
I need to trigger player jump at one moment with some forward velocity.
Did some of you guys do somethingn like this?
Can we make player jump with source python?
Can we make player jump with source python?
Last edited by khaimovmr on Mon Jul 12, 2021 2:49 pm, edited 1 time in total.
Re: Can we make player jump with source python?
just search the forums for it. i think there a many topics about it.
Re: Can we make player jump with source python?
Speed0x wrote:just search the forums for it. i think there a many topics about it.
Did it. No luck so far.
Re: Can we make player jump with source python?
look for onplayerruncommand for forcing the jump.
depending on what you want to with the velocity you could inject into the Event('player_jump').
i think this post can be useful or you can give more info on what exactly you want to be done.
viewtopic.php?f=7&t=2113&p=14350&hilit=velocity#p14350
depending on what you want to with the velocity you could inject into the Event('player_jump').
i think this post can be useful or you can give more info on what exactly you want to be done.
viewtopic.php?f=7&t=2113&p=14350&hilit=velocity#p14350
Re: Can we make player jump with source python?
Yes, you can either inject the jump button in PlayerRunCommand (maybe Player.buttons works as well) or emulate a jump e. g. by using Player.push.
Re: Can we make player jump with source python?
That's absolutely insane, guys! Thank you. Will try on this weekend.
-
- Junior Member
- Posts: 4
- Joined: Thu Jul 13, 2023 6:33 pm
Re: Can we make player jump with source python?
In case anyone comes across this topic, this worked for me in TF2:
Syntax: Select all
from players.constants import PlayerButtons
def force_buttons(player, buttons, time=0.25):
"""Forces the given buttons on the given player for the given time."""
# Save the current forced buttons
forced_buttons = player.get_datamap_property_int('m_afButtonForced')
# Apply the given buttons
player.set_datamap_property_int('m_afButtonForced', forced_buttons | buttons)
# Restore the original buttons after the given time
player.delay(
time,
player.set_datamap_property_int,
('m_afButtonForced', forced_buttons))
force_buttons(player, PlayerButtons.JUMP)
Return to “Plugin Development Support”
Who is online
Users browsing this forum: Bing [Bot] and 94 guests