-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
с++:
inline bool shouldEdgebug;
inline float zVelBackup;
inline float bugSpeed;
inline int edgebugButtons;
void(__stdcall* restoreEntityToPredictedFrame)(int, int);
void BunnyHop::Prepred(CUserCmd* cmd) {
zVelBackup = g_LocalPlayer->m_vecVelocity().z;
if (shouldEdgebug)
cmd->buttons = edgebugButtons;
static auto sv_gravity = g_CVar->FindVar("sv_gravity");
bugSpeed = (sv_gravity->GetFloat() * 0.5f * g_GlobalVars->interval_per_tick);
static float flZVelPrev = zVelBackup;
shouldEdgebug = zVelBackup < -bugSpeed && round(g_LocalPlayer->m_vecVelocity().z) == -round(bugSpeed) && g_LocalPlayer->m_nMoveType() != MOVETYPE_LADDER;
flZVelPrev = zVelBackup;
}
void BunnyHop::edgeBug(CUserCmd* cmd, QAngle& angView)
{
if (!g_Options.edge_bug || !GetAsyncKeyState(g_Options.edge_bug_key))
return;
if (g_LocalPlayer->m_fFlags() & 1)
return;
shouldEdgebug = zVelBackup < -bugSpeed && round(g_LocalPlayer->m_vecVelocity().z) == -round(bugSpeed) && g_LocalPlayer->m_nMoveType() != MOVETYPE_LADDER;
if (shouldEdgebug)
return;
int nCommandsPredicted = interfaces->prediction->split->commandsPredicted;
QAngle angViewOriginal = angView;
QAngle angCmdViewOriginal = cmd->viewangles;
int buttonsOriginal = cmd->buttons;
Vector vecMoveOriginal;
vecMoveOriginal.x = cmd->sidemove;
vecMoveOriginal.y = cmd->forwardmove;
static Vector vecMoveLastStrafe;
static QAngle angViewLastStrafe;
static QAngle angViewOld = angView;
static QAngle angViewDeltaStrafe;
static bool bAppliedStrafeLast = false;
if (!bAppliedStrafeLast)
{
angViewLastStrafe = angView;
vecMoveLastStrafe = vecMoveOriginal;
angViewDeltaStrafe = (angView - angViewOld);
angViewDeltaStrafe;
}
bAppliedStrafeLast = false;
angViewOld = angView;
for (int t = 0; t < 4; t++)
{
static int iLastType;
if (iLastType)
{
t = iLastType;
iLastType = 0;
}
restoreEntityToPredictedFrame(0, nCommandsPredicted - 1);
if (buttonsOriginal& IN_DUCK&& t < 2)
t = 2;
bool bApplyStrafe = !(t % 2);
bool bApplyDuck = t > 1;
cmd->viewangles = angViewLastStrafe;
cmd->buttons = buttonsOriginal;
cmd->sidemove = vecMoveLastStrafe.x;
cmd->forwardmove = vecMoveLastStrafe.y;
for (int i = 0; i < g_Options.ebtick; i++)
{
if (bApplyDuck)
cmd->buttons |= IN_DUCK;
else
cmd->buttons &= ~IN_DUCK;
if (bApplyStrafe)
{
cmd->viewangles += angViewDeltaStrafe;
cmd->viewangles.Normalize();
cmd->viewangles.Length();
}
else
{
cmd->sidemove = 0.f;
cmd->forwardmove = 0.f;
}
prediction->StartPrediction(cmd);
shouldEdgebug = zVelBackup < -bugSpeed && round(g_LocalPlayer->m_vecVelocity().z) == -round(bugSpeed) && g_LocalPlayer->m_nMoveType() != MOVETYPE_LADDER;
zVelBackup = g_LocalPlayer->m_vecVelocity().z;
if (shouldEdgebug)
{
edgebugButtons = cmd->buttons;
if (bApplyStrafe)
{
bAppliedStrafeLast = true;
angView = (angViewLastStrafe + angViewDeltaStrafe);
angView.Normalize();
angView.Length();
angViewLastStrafe = angView;
cmd->sidemove = vecMoveLastStrafe.x;
cmd->forwardmove = vecMoveLastStrafe.y;
}
cmd->viewangles = angCmdViewOriginal;
iLastType = t;
return;
}
if (g_LocalPlayer->m_fFlags() & 1 || g_LocalPlayer->m_nMoveType() == MOVETYPE_LADDER)
break;
}
}
cmd->viewangles = angCmdViewOriginal;
angView = angViewOriginal;
cmd->buttons = buttonsOriginal;
cmd->sidemove = vecMoveOriginal.x;
cmd->forwardmove = vecMoveOriginal.y;
}
Последнее редактирование: