Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace LegitBacktracking
- {
- std::deque<BacktrackingRecord>PlayerRecords[65];
- void CM(void)
- {
- float bestFov = FLT_MAX;
- int bestbacktracktarget = -1;
- for (int x = 1; x < I::Globals->maxClients; x++)
- {
- auto Enemy = I::ClientEntList->GetClientEntity(x);
- if (!Enemy || Enemy == G::LocalPlayer || !Enemy->IsPlayer() || !Enemy->GetAlive() || Enemy->GetDormant() || Enemy->GetImmune() || Enemy->GetTeam() == G::LocalPlayer->GetTeam())
- {
- if (PlayerRecords[x].size() > 0)
- PlayerRecords[x].clear();
- continue;
- }
- while (true)
- {
- if (PlayerRecords[x].size() > static_cast<size_t>(Vars.Legitbot.Aimbot.Ticks))
- {
- PlayerRecords[x].pop_back();
- }
- else
- {
- break;
- }
- }
- if (PlayerRecords[x].empty() || PlayerRecords[x].front().Tick != G::UserCmd->tick_count)
- {
- matrix3x4_t Matrix[MAXSTUDIOBONES];
- if (!Enemy->SetupBones2(Matrix, MAXSTUDIOBONES, BONE_USED_BY_HITBOX, I::Globals->curtime))
- {
- static auto& enable_bone_cache_invalidation = **reinterpret_cast<bool**>(uint32_t(U::FindPattern("client_panorama.dll", "C6 05 ? ? ? ? ? 89 47 70")) + 2);
- const auto old_invalidation = enable_bone_cache_invalidation;
- G::EnableBones = Enemy->GetClientSideAnimation() = true;
- *(Vector*)((uintptr_t)Enemy + 0xA0) = Enemy->GetOrigin();
- *(int*)((uintptr_t)Enemy + 0xA68) = 0;
- *(int*)((uintptr_t)Enemy + 0xA30) = 0;
- Enemy->SetupBones2(Matrix, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, I::Globals->curtime);
- G::EnableBones = false;
- Enemy->UpdateClientSideAnimation();
- Enemy->GetClientSideAnimation() = false;
- enable_bone_cache_invalidation = old_invalidation;
- }
- Vector vPoint;
- if (Vars.Ragebot.Enabled && G::RageHitBox != -1)
- {
- vPoint = Enemy->GetHitboxPos(G::RageHitBox, Matrix);
- }
- else if (Vars.Legitbot.Aimbot.Enabled)
- {
- vPoint = Enemy->GetHitboxPos(Vars.Legitbot.Aimbot.Hitbox, Matrix);
- }
- else
- {
- vPoint = Enemy->GetHitboxPos(HITBOX_HEAD, Matrix);
- }
- auto CurRecord = BacktrackingRecord(G::UserCmd->tick_count, vPoint, Matrix);
- if (CurRecord.ValidTick())
- {
- PlayerRecords[x].insert(PlayerRecords[x].begin(), CurRecord);
- }
- QAngle CalcAngled = M::CalcAngle(G::LocalPlayer->GetEyePosition(), vPoint);
- CalcAngled -= G::LocalPlayer->GetPunch() * 2.f;
- float fov = M::GetFov(G::UserCmd->viewangles, CalcAngled);
- if (fov < bestFov)
- {
- bestFov = fov;
- bestbacktracktarget = x;
- }
- }
- }
- if (bestbacktracktarget != -1)
- {
- if (PlayerRecords[bestbacktracktarget].size() > 0)
- {
- float tempFloat = FLT_MAX;
- for (auto tick : PlayerRecords[bestbacktracktarget])
- {
- QAngle CalcAngled = M::CalcAngle(G::LocalPlayer->GetEyePosition(), tick.Position);
- CalcAngled -= G::LocalPlayer->GetPunch() * 2.f;
- float fov = M::GetFov(G::UserCmd->viewangles, CalcAngled);
- if (fov < tempFloat)
- {
- tempFloat = fov;
- if (G::UserCmd->buttons & IN_ATTACK)
- {
- G::UserCmd->tick_count = tick.Tick + U::GetLerpTime();
- }
- }
- }
- }
- }
- }
- void PT(void)
- {
- for (int x = 1; x < 65; x++)
- {
- auto Enemy = I::ClientEntList->GetClientEntity(x);
- if (PlayerRecords[x].empty() || !Enemy)
- continue;
- auto pStudioModel = I::ModelInfo->GetStudioModel(Enemy->GetModel());
- if (!pStudioModel)
- continue;
- if (!G::LocalPlayer->GetAlive())
- continue;
- if (Enemy == G::LocalPlayer)
- continue;
- if (!Enemy->IsPlayer())
- continue;
- if (!Enemy->GetAlive())
- continue;
- if (Enemy->GetImmune())
- continue;
- if (Enemy->GetDormant())
- continue;
- if (Enemy->GetTeam() == G::LocalPlayer->GetTeam())
- continue;
- for (auto tick : PlayerRecords[x])
- {
- for (int i = 0; i < pStudioModel->numbones; i++)
- {
- auto pBone = pStudioModel->GetBone(i);
- if (!pBone || !(pBone->flags & 256) || pBone->parent == -1)
- continue;
- Vector vBonePos1;
- if (!M::WorldToScreen(Vector(tick.Matrix[i][0][3], tick.Matrix[i][1][3], tick.Matrix[i][2][3]), vBonePos1))
- continue;
- Vector vBonePos2;
- if (!M::WorldToScreen(Vector(tick.Matrix[pBone->parent][0][3], tick.Matrix[pBone->parent][1][3], tick.Matrix[pBone->parent][2][3]), vBonePos2))
- continue;
- D::DrawLine((int)vBonePos1.x, (int)vBonePos1.y, (int)vBonePos2.x, (int)vBonePos2.y, Color(0, 255, 255, 24));//12 brightness p
- }
- }
- }
- }
- }
- namespace LegitBacktracking2
- {
- std::deque<BacktrackingRecord2>PlayerRecords2[65];
- bool ValidTick2(int tick)
- {
- float correct = 0.f;
- static auto sv_maxunlag = I::Cvar->FindVar("sv_maxunlag");
- correct += I::Engine->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING);
- correct += I::Engine->GetNetChannelInfo()->GetLatency(FLOW_INCOMING);
- correct += U::GetLerpTime();
- correct = U::Clamp(correct, 0.f, sv_maxunlag->GetFloat());
- float deltaTime = correct - (I::Globals->curtime - tick);
- if (fabsf(deltaTime) > 0.2f)
- {
- return true;
- }
- return false;
- }
- void CM2(void)
- {
- float bestFov2 = FLT_MAX;
- int bestbacktracktarget2 = -1;
- for (int x = 1; x < I::Globals->maxClients; x++)
- {
- auto Enemy2 = I::ClientEntList->GetClientEntity(x);
- if (!Enemy2 || Enemy2 == G::LocalPlayer || !Enemy2->IsPlayer() || !Enemy2->GetAlive() || Enemy2->GetDormant() || Enemy2->GetImmune() || Enemy2->GetTeam() == G::LocalPlayer->GetTeam())
- {
- if (PlayerRecords2[x].size() > 0)
- PlayerRecords2[x].clear();
- continue;
- }
- while (true)
- {
- if (PlayerRecords2[x].size() > static_cast<size_t>(Vars.Legitbot.Aimbot.Ticks))
- {
- PlayerRecords2[x].pop_back();
- }
- else
- {
- break;
- }
- }
- if (!PlayerRecords2[x].empty())
- {
- if (PlayerRecords2[x].front().Tick2 == G::UserCmd->tick_count)
- {
- continue;
- }
- }
- if (PlayerRecords2[x].size() > 0)
- {
- for (int tick = 0; tick < PlayerRecords2[x].size(); tick++)
- {
- if (!ValidTick2(PlayerRecords2[x].at(tick).Tick2))
- {
- PlayerRecords2[x].erase(PlayerRecords2[x].begin() + tick);
- continue;
- }
- }
- }
- matrix3x4_t Matrix2[MAXSTUDIOBONES];
- static auto& enable_bone_cache_invalidation2 = **reinterpret_cast<bool**>(uint32_t(U::FindPattern("client_panorama.dll", "C6 05 ? ? ? ? ? 89 47 70")) + 2);
- const auto old_invalidation2 = enable_bone_cache_invalidation2;
- G::EnableBones = Enemy2->GetClientSideAnimation() = true;
- *(Vector*)((uintptr_t)Enemy2 + 0xA0) = Enemy2->GetOrigin();
- *(int*)((uintptr_t)Enemy2 + 0xA68) = 0;
- *(int*)((uintptr_t)Enemy2 + 0xA30) = 0;
- Enemy2->SetupBones2(Matrix2, MAXSTUDIOBONES, BONE_USED_BY_ANYTHING, I::Globals->curtime);
- G::EnableBones = false;
- Enemy2->UpdateClientSideAnimation();
- Enemy2->GetClientSideAnimation() = false;
- enable_bone_cache_invalidation2 = old_invalidation2;
- Vector vPoint2 = Enemy2->GetHitboxPos(HITBOX_HEAD, Matrix2);
- auto CurRecord2 = BacktrackingRecord2(G::UserCmd->tick_count, vPoint2, Matrix2);
- PlayerRecords2[x].insert(PlayerRecords2[x].begin(), CurRecord2);
- QAngle CalcAngled2 = M::CalcAngle(G::LocalPlayer->GetEyePosition(), vPoint2);
- CalcAngled2 -= G::LocalPlayer->GetPunch() * 2.f;
- float fov2 = M::GetFov(G::UserCmd->viewangles, CalcAngled2);
- if (fov2 < bestFov2)
- {
- bestFov2 = fov2;
- bestbacktracktarget2 = x;
- }
- }
- if (bestbacktracktarget2 != -1)
- {
- if (PlayerRecords2[bestbacktracktarget2].size() > 0)
- {
- float tempFloat2 = FLT_MAX;
- for (auto tick : PlayerRecords2[bestbacktracktarget2])
- {
- QAngle CalcAngled2 = M::CalcAngle(G::LocalPlayer->GetEyePosition(), tick.Position2);
- CalcAngled2 -= G::LocalPlayer->GetPunch() * 2.f;
- float fov2 = M::GetFov(G::UserCmd->viewangles, CalcAngled2);
- if (fov2 < tempFloat2)
- {
- tempFloat2 = fov2;
- if (G::UserCmd->buttons & IN_ATTACK)
- {
- G::UserCmd->tick_count = tick.Tick2 + U::GetLerpTime();
- }
- }
- }
- }
- }
- }
- void PT2(void)
- {
- for (int x = 1; x < 65; x++)
- {
- auto Enemy = I::ClientEntList->GetClientEntity(x);
- if (PlayerRecords2[x].empty() || !Enemy)
- continue;
- auto pStudioModel = I::ModelInfo->GetStudioModel(Enemy->GetModel());
- if (!pStudioModel)
- continue;
- if (!G::LocalPlayer->GetAlive())
- continue;
- if (Enemy == G::LocalPlayer)
- continue;
- if (!Enemy->IsPlayer())
- continue;
- if (!Enemy->GetAlive())
- continue;
- if (Enemy->GetImmune())
- continue;
- if (Enemy->GetDormant())
- continue;
- if (Enemy->GetTeam() == G::LocalPlayer->GetTeam())
- continue;
- for (auto tick : PlayerRecords2[x])
- {
- for (int i = 0; i < pStudioModel->numbones; i++)
- {
- auto pBone = pStudioModel->GetBone(i);
- if (!pBone || !(pBone->flags & 256) || pBone->parent == -1)
- continue;
- Vector vBonePos1;
- if (!M::WorldToScreen(Vector(tick.Matrix2[i][0][3], tick.Matrix2[i][1][3], tick.Matrix2[i][2][3]), vBonePos1))
- continue;
- Vector vBonePos2;
- if (!M::WorldToScreen(Vector(tick.Matrix2[pBone->parent][0][3], tick.Matrix2[pBone->parent][1][3], tick.Matrix2[pBone->parent][2][3]), vBonePos2))
- continue;
- D::DrawLine((int)vBonePos1.x, (int)vBonePos1.y, (int)vBonePos2.x, (int)vBonePos2.y, Color(0, 255, 255, 24));//12 brightness p
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement