-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathautostop.txt
121 lines (96 loc) · 3.48 KB
/
autostop.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
float& C_BasePlayer::m_surfaceFriction()
{
static unsigned int _m_surfaceFriction = FindInDataMap(GetPredDescMap(), "m_surfaceFriction");
return *(float*)((uintptr_t)this + _m_surfaceFriction);
}
void Movement::Quick_stop(CUserCmd* cmd)
{
if (!ctx.m_local())
return;
Vector hvel = ctx.m_local()->m_vecVelocity();
hvel.z = 0;
float speed = hvel.Length2D();
if (speed < 1.f)
{
cmd->forwardmove = 0.f;
cmd->sidemove = 0.f;
return;
}
static float accel = csgo.m_engine_cvars()->FindVar("sv_accelerate")->GetFloat();
static float maxSpeed = csgo.m_engine_cvars()->FindVar("sv_maxspeed")->GetFloat();
float playerSurfaceFriction = ctx.m_local()->m_surfaceFriction();
float max_accelspeed = accel * csgo.m_globals()->interval_per_tick * maxSpeed * playerSurfaceFriction;
float wishspeed{};
if (speed - max_accelspeed <= -1.f)
{
// speed - accelspeed = 0
// speed - accel*frametime*wishspeed = 0
// accel*frametime*wishspeed = speed
// wishspeed = speed / (accel*frametime)
wishspeed = max_accelspeed / (speed / (accel * csgo.m_globals()->interval_per_tick));
}
else // Full deceleration, since it won't overshoot
{
// Or use max_accelspeed, doesn't matter
wishspeed = max_accelspeed;
}
Vector ndir = (hvel * -1.f); Math::VectorAngles(ndir, ndir);
ndir.y = cmd->viewangles.y - ndir.y;
Math::AngleVectors(ndir, &ndir);
cmd->forwardmove = ndir.x * wishspeed;
cmd->sidemove = ndir.y * wishspeed;
}
ctx.do_autostop = true в аимботе
саму функцию вызывать ПЕРЕД EnginePrediction.
void c_aimbot::autostop(CUserCmd* cmd, bool& send_packet, C_WeaponCSBaseGun* local_weapon)
{
static auto accel = csgo.m_engine_cvars()->FindVar("sv_accelerate");
if (ctx.m_settings.aimbot_autostop == 0)
return;
static bool was_onground = ctx.m_local()->m_fFlags() & FL_ONGROUND;
if (ctx.do_autostop && local_weapon && local_weapon->GetCSWeaponData() && was_onground && ctx.m_local()->m_fFlags() & FL_ONGROUND)
{
auto speed = ((cmd->sidemove * cmd->sidemove) + (cmd->forwardmove * cmd->forwardmove));
auto lol = sqrt(speed);
auto velocity = ctx.m_local()->m_vecVelocity() + (ctx.m_local()->m_vecVelocity() * csgo.m_globals()->interval_per_tick);
float maxspeed = 30.f;
if (!ctx.m_local()->m_bIsScoped())
maxspeed = *(float*)(uintptr_t(local_weapon->GetCSWeaponData()) + 0x130);
else
maxspeed = *(float*)(uintptr_t(local_weapon->GetCSWeaponData()) + 0x134);//local_weapon->GetCSWeaponData()->max_speed;
maxspeed *= 0.31f;
float max_accelspeed = accel->GetFloat() * csgo.m_globals()->interval_per_tick * m_weapon()->GetMaxWeaponSpeed() * ctx.m_local()->m_surfaceFriction();
switch (ctx.m_settings.aimbot_autostop)
{
case 1:
{
cmd->buttons |= IN_SPEED;
if ((velocity.Length2D() + 1.f) > maxspeed)
{
// cmd->buttons |= IN_WALK;
//Engine::Movement::Instance()->quick_stop(cmd);
if ((maxspeed + 1.0f) <= velocity.Length2D())
{
cmd->forwardmove = 0.0f;
cmd->sidemove = 0.0f;
}
else
{
cmd->sidemove = (maxspeed * (cmd->sidemove / lol));
cmd->forwardmove = (maxspeed * (cmd->forwardmove / lol));
}
}
}
break;
case 2:
{
cmd->buttons |= IN_SPEED;
Engine::Movement::Instance()->Quick_stop(cmd);
}
break;
}
/*Engine::Movement::Instance()->m_qAnglesView.y = RAD2DEG(std::atan2(ctx.m_local()->m_vecVelocity().y, ctx.m_local()->m_vecVelocity().x)) - 180.f;*/
ctx.do_autostop = false;
}
was_onground = (ctx.m_local()->m_fFlags() & FL_ONGROUND);
}