UwUHax/bhop.h
2021-08-27 18:58:23 +07:00

32 lines
549 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
void RunBhop(CUserCmd* cmd, CBaseEntity* pLocal)
{
static bool jumped_last_tick = false;
static bool should_fake_jump = false;
if (!jumped_last_tick && should_fake_jump)
{
should_fake_jump = false;
cmd->buttons |= IN_JUMP;
}
else if (cmd->buttons & IN_JUMP)
{
if (pLocal->GetFlags() & FL_ONGROUND)
{
jumped_last_tick = true;
should_fake_jump = true;
}
else
{
cmd->buttons &= ~IN_JUMP;
jumped_last_tick = false;
}
}
else
{
jumped_last_tick = false;
should_fake_jump = false;
}
}