Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Aimbot.h"
- #include "Autowall.h"
- #include "Backtrack.h"
- #include "..\..\csgo_sdk\IVModelInfo.h"
- #include "..\..\csgo_utilities\Utils.h"
- #include "..\..\csgo_sdk\IVEngineClient.h"
- #include "..\..\csgo_features\csgo_anti_aim\AntiAim.h"
- #include "..\..\csgo_sdk\PlayerInfo.h"
- #include "..\..\csgo_sdk\ICvar.h"
- #include "..\..\csgo_utilities\Math.h"
- #include "..\..\csgo_sdk\Hitboxes.h"
- #include "..\..\csgo_menu\Menu.h"
- #include "..\..\csgo_sdk\ISurface.h"
- #include "..\..\csgo_sdk\Definitions.h"
- Aimbot g_Aimbot;
- void Aimbot::Autostop()
- {
- if (!g_Menu.Config.Autostop)
- return;
- Vector Velocity = g::pLocalEntity->GetVelocity();
- static float Speed = 450.f;
- Vector Direction;
- Vector RealView;
- g_Math.VectorAngles(Velocity, Direction);
- g_pEngine->GetViewAngles(RealView);
- Direction.y = RealView.y - Direction.y;
- Vector Forward;
- g_Math.AngleVectors(Direction, &Forward);
- Vector NegativeDirection = Forward * -Speed;
- g::pCmd->forwardmove = NegativeDirection.x;
- g::pCmd->sidemove = NegativeDirection.y;
- }
- /*void CAimbot::Autostop()
- {
- if (!g_Menu.Config.Autostop)
- return;
- Vector Velocity = g::pLocalEntity->GetVelocity();
- static float Speed = 450.f;
- Vector Direction;
- Vector RealView;
- g_Math.VectorAngles(Velocity, Direction);
- g_pEngine->GetViewAngles(RealView);
- Direction.y = RealView.y - Direction.y;
- Vector Forward;
- g_Math.AngleVectors(Direction, &Forward);
- Vector NegativeDirection = Forward * -Speed;
- g::pCmd->forwardmove = NegativeDirection.x;
- g::pCmd->sidemove = NegativeDirection.y;
- }*/
- float Aimbot::accepted_inaccuracy(C_BaseCombatWeapon* weapon)
- {
- if (!g::pLocalEntity) return 0;
- if (weapon->GetName() == "weapon_taser") return 0;
- if (!weapon) return false;
- float inaccuracy = weapon->GetInaccuracy();
- return inaccuracy < (float)15 / 1000.f;
- }
- bool Aimbot::HitChance(C_BaseEntity* pEnt, C_BaseCombatWeapon* pWeapon, Vector Angle, Vector Point, int chance)
- {
- if (chance == 0 || g_Menu.Config.Hitchance == 0)
- return true;
- if (Backtrack[pEnt->EntIndex()] || ShotBacktrack[pEnt->EntIndex()]) // doing this bec im lazy
- {
- float Velocity = g::pLocalEntity->GetVelocity().Length();
- if (Velocity <= (g::pLocalEntity->GetActiveWeapon()->GetCSWpnData()->max_speed_alt * .34f))
- Velocity = 0.0f;
- float SpreadCone = pWeapon->GetAccuracyPenalty() * 256.0f / M_PI + pWeapon->GetCSWpnData()->max_speed * Velocity / 3000.0f; // kmeth https://github.com/DankPaster/kmethdude
- float a = (Point - g::pLocalEntity->GetEyePosition()).Length();
- float b = sqrt(tan(SpreadCone * M_PI / 180.0f) * a);
- if (2.2f > b) return true;
- return (chance <= ((2.2f / fmax(b, 2.2f)) * 100.0f));
- }
- if (g_Menu.Config.Hitchance == 1 || g_Menu.Config.Hitchance == 2)
- {
- float Seeds = (g_Menu.Config.Hitchance == 1) ? 356.f : 256.f;
- Angle -= (g::pLocalEntity->GetAimPunchAngle() * g_pCvar->FindVar("weapon_recoil_scale")->GetFloat());
- Vector forward, right, up;
- g_Math.AngleVectors(Angle, &forward, &right, &up);
- int Hits = 0, neededHits = (Seeds * (chance / 100.f));
- float weapSpread = pWeapon->GetSpread(), weapInaccuracy = pWeapon->GetInaccuracy();
- for (int i = 0; i < Seeds; i++)
- {
- float Inaccuracy = g_Math.RandomFloat(0.f, 1.f) * weapInaccuracy;
- float Spread = g_Math.RandomFloat(0.f, 1.f) * weapSpread;
- Vector spreadView((cos(g_Math.RandomFloat(0.f, 2.f * M_PI)) * Inaccuracy) + (cos(g_Math.RandomFloat(0.f, 2.f * M_PI)) * Spread), (sin(g_Math.RandomFloat(0.f, 2.f * M_PI)) * Inaccuracy) + (sin(g_Math.RandomFloat(0.f, 2.f * M_PI)) * Spread), 0), direction;
- direction = Vector(forward.x + (spreadView.x * right.x) + (spreadView.y * up.x), forward.y + (spreadView.x * right.y) + (spreadView.y * up.y), forward.z + (spreadView.x * right.z) + (spreadView.y * up.z)).Normalize();
- Vector viewanglesSpread, viewForward;
- g_Math.VectorAngles(direction, up, viewanglesSpread);
- g_Math.NormalizeAngles(viewanglesSpread);
- g_Math.AngleVectors(viewanglesSpread, &viewForward);
- viewForward.NormalizeInPlace();
- viewForward = g::pLocalEntity->GetEyePosition() + (viewForward * pWeapon->GetCSWpnData()->range);
- CGameTrace Trace;
- g_pEngineTrace->ClipRayToEntity(Ray_t(g::pLocalEntity->GetEyePosition(), viewForward), MASK_SHOT | CONTENTS_GRATE, pEnt, &Trace);
- if (Trace.hit_entity == pEnt)
- Hits++;
- if (((Hits / Seeds) * 100.f) >= chance)
- return true;
- if ((Seeds - i + Hits) < neededHits)
- return false;
- }
- }
- if (g_Menu.Config.Hitchance == 3)
- {
- if (accepted_inaccuracy(pWeapon) >= g_Menu.Config.HitchanceValue)
- return true;
- }
- return false;
- }
- bool ShouldBaim(C_BaseEntity* pEnt) // probably dosnt make sense
- {
- static float oldSimtime[65];
- static float storedSimtime[65];
- static float ShotTime[65];
- static float NextShotTime[65];
- static bool BaimShot[65];
- if (storedSimtime[pEnt->EntIndex()] != pEnt->GetSimulationTime())
- {
- oldSimtime[pEnt->EntIndex()] = storedSimtime[pEnt->EntIndex()];
- storedSimtime[pEnt->EntIndex()] = pEnt->GetSimulationTime();
- }
- float simDelta = storedSimtime[pEnt->EntIndex()] - oldSimtime[pEnt->EntIndex()];
- bool Shot = false;
- if (pEnt->GetActiveWeapon() && !pEnt->IsKnifeorNade())
- {
- if (ShotTime[pEnt->EntIndex()] != pEnt->GetActiveWeapon()->GetLastShotTime())
- {
- Shot = true;
- BaimShot[pEnt->EntIndex()] = false;
- ShotTime[pEnt->EntIndex()] = pEnt->GetActiveWeapon()->GetLastShotTime();
- }
- else
- Shot = false;
- }
- else
- {
- Shot = false;
- ShotTime[pEnt->EntIndex()] = 0.f;
- }
- if (Shot)
- {
- NextShotTime[pEnt->EntIndex()] = pEnt->GetSimulationTime() + pEnt->FireRate();
- if (simDelta >= pEnt->FireRate())
- BaimShot[pEnt->EntIndex()] = true;
- }
- if (BaimShot[pEnt->EntIndex()])
- {
- if (pEnt->GetSimulationTime() >= NextShotTime[pEnt->EntIndex()])
- BaimShot[pEnt->EntIndex()] = false;
- }
- if (g_Menu.Config.BaimPitch && BaimShot[pEnt->EntIndex()] && !(pEnt->GetFlags() & FL_ONGROUND))
- return true;
- if (g_Menu.Config.BaimInAir && !(pEnt->GetFlags() & FL_ONGROUND))
- return true;
- return false;
- }
- Vector Aimbot::Hitscan(C_BaseEntity* pEnt)
- {
- Vector local_position = g::pLocalEntity->GetOrigin() + g::pLocalEntity->GetViewOffset();
- float DamageArray[27];
- float tempDmg = 0.f;
- Vector tempHitbox = { 0,0,0 };
- static int HitboxForMuti[] = { 2,2,4,4,6,6 };
- float angToLocal = g_Math.CalcAngle(g::pLocalEntity->GetOrigin(), pEnt->GetOrigin()).y;
- Vector2D MutipointXY = { (sin(g_Math.GRD_TO_BOG(angToLocal))),(cos(g_Math.GRD_TO_BOG(angToLocal))) };
- Vector2D MutipointXY180 = { (sin(g_Math.GRD_TO_BOG(angToLocal + 180))) ,(cos(g_Math.GRD_TO_BOG(angToLocal + 180))) };
- Vector2D Mutipoint[] = { Vector2D(MutipointXY.x, MutipointXY.y), Vector2D(MutipointXY180.x, MutipointXY180.y) };
- float Velocity = abs(pEnt->GetVelocity().Length2D());
- if (!g_Menu.Config.DelayShot && Velocity > 29.f)
- Velocity = 30.f;
- std::vector<int> Scan;
- int HeadHeight = 50;
- bool Baim = ShouldBaim(pEnt);
- if (!Baim)
- Scan.push_back(HITBOX_HEAD);
- if (Velocity <= 215.f || Baim)
- {
- Scan.push_back(HITBOX_PELVIS);
- Scan.push_back(HITBOX_THORAX);
- Scan.push_back(HITBOX_LOWER_CHEST);
- Scan.push_back(HITBOX_UPPER_CHEST);
- if (g_Menu.Config.MultiPoint)
- {
- Scan.push_back(19);//pelvis
- Scan.push_back(20);
- Scan.push_back(21);//thorax
- Scan.push_back(22);
- Scan.push_back(23);//upperchest
- Scan.push_back(24);
- if (Velocity <= 80.f && !Baim)
- {
- Scan.push_back(25);//head
- Scan.push_back(26);
- }
- HeadHeight = g_Menu.Config.HeadScale;
- }
- if (!g_Menu.Config.IgnoreLimbs)
- Velocity = 0.f;
- if (Velocity <= 29.f)
- {
- Scan.push_back(HITBOX_LEFT_FOOT);
- Scan.push_back(HITBOX_RIGHT_FOOT);
- Scan.push_back(HITBOX_LEFT_UPPER_ARM);
- Scan.push_back(HITBOX_RIGHT_UPPER_ARM);
- Scan.push_back(HITBOX_LEFT_THIGH);
- Scan.push_back(HITBOX_RIGHT_THIGH);
- }
- }
- Vector Hitbox;
- int bestHitboxint = 0;
- for (int hitbox : Scan)
- {
- if (hitbox < 19)
- Hitbox = pEnt->GetHitboxPosition(hitbox, Matrix[pEnt->EntIndex()]) + Vector(0, 0, (hitbox == 0) ? -5 + (HeadHeight / 10.f) : 0);
- else if (hitbox > 18 && hitbox < 25)
- {
- float Radius = 0;
- Hitbox = pEnt->GetHitboxPosition(HitboxForMuti[hitbox - 19], Matrix[pEnt->EntIndex()], &Radius);
- Radius *= (g_Menu.Config.BodyScale / 100.f);
- Hitbox = Vector(Hitbox.x + (Radius * Mutipoint[((hitbox - 19) % 2)].x), Hitbox.y - (Radius * Mutipoint[((hitbox - 19) % 2)].y), Hitbox.z);
- }
- else if (hitbox > 24 && hitbox < 27)
- {
- float Radius = 0;
- Hitbox = pEnt->GetHitboxPosition(0, Matrix[pEnt->EntIndex()], &Radius);
- Radius *= (HeadHeight / 100.f);
- Hitbox = Vector(Hitbox.x + (Radius * Mutipoint[((hitbox - 25) % 2)].x), Hitbox.y - (Radius * Mutipoint[((hitbox - 25) % 2)].y), Hitbox.z);
- }
- float Damage = g_AutoWall.CanHit(Hitbox);
- if (Damage > 0.f)
- DamageArray[hitbox] = Damage;
- else
- DamageArray[hitbox] = 0;
- if (g_Menu.Config.BaimLethal && hitbox != 0 && hitbox != 25 && hitbox != 26 && Damage >= (pEnt->GetHealth() + 10))
- {
- DamageArray[hitbox] = 400;
- }
- if (DamageArray[hitbox] > tempDmg)
- {
- tempHitbox = Hitbox;
- bestHitboxint = hitbox;
- tempDmg = DamageArray[hitbox];
- }
- g::AimbotHitbox[pEnt->EntIndex()][hitbox] = Hitbox;
- }
- PlayerRecords pPlayerEntityRecord = g_LagComp.PlayerRecord[pEnt->EntIndex()].at(0);
- Backtrack[pEnt->EntIndex()] = false;
- ShotBacktrack[pEnt->EntIndex()] = false;
- if (g_Menu.Config.ShotBacktrack && g_LagComp.ShotTick[pEnt->EntIndex()] != -1 && g_AutoWall.CanHitFloatingPoint(pEnt->GetHitboxPosition(HITBOX_HEAD, g_LagComp.PlayerRecord[pEnt->EntIndex()].at(g_LagComp.ShotTick[pEnt->EntIndex()]).Matrix) + Vector(0, 0, 1), g::pLocalEntity->GetEyePosition()) && !Baim)
- {
- bestEntDmg = (1000000.f - fabs(g_Math.Distance(Vector2D(g::pLocalEntity->GetOrigin().x, g::pLocalEntity->GetOrigin().y), Vector2D(pEnt->GetOrigin().x, pEnt->GetOrigin().y)))); // just doing this to get the closest player im backtracking
- ShotBacktrack[pEnt->EntIndex()] = true;
- return pEnt->GetHitboxPosition(HITBOX_HEAD, g_LagComp.PlayerRecord[pEnt->EntIndex()].at(g_LagComp.ShotTick[pEnt->EntIndex()]).Matrix) + Vector(0, 0, 1);
- }
- else if (tempDmg >= g_Menu.Config.Mindmg)
- {
- bestEntDmg = tempDmg;
- if ((bestHitboxint == 25 || bestHitboxint == 26 || bestHitboxint == 27) && abs(DamageArray[HITBOX_HEAD] - DamageArray[bestHitboxint]) <= 10.f)
- return pEnt->GetHitboxPosition(HITBOX_HEAD, Matrix[pEnt->EntIndex()]);
- else if ((bestHitboxint == 19 || bestHitboxint == 20) && DamageArray[HITBOX_PELVIS] > 30)
- return pEnt->GetHitboxPosition(HITBOX_PELVIS, Matrix[pEnt->EntIndex()]);
- else if ((bestHitboxint == 21 || bestHitboxint == 22) && DamageArray[HITBOX_THORAX] > 30)
- return pEnt->GetHitboxPosition(HITBOX_THORAX, Matrix[pEnt->EntIndex()]);
- else if ((bestHitboxint == 23 || bestHitboxint == 24) && DamageArray[HITBOX_UPPER_CHEST] > 30)
- return pEnt->GetHitboxPosition(HITBOX_UPPER_CHEST, Matrix[pEnt->EntIndex()]);
- return tempHitbox;
- }
- else if (g_Menu.Config.PosBacktrack && pPlayerEntityRecord.Velocity >= 29.f && g_AutoWall.CanHitFloatingPoint(pEnt->GetHitboxPosition(HITBOX_HEAD, pPlayerEntityRecord.Matrix), g::pLocalEntity->GetEyePosition()))
- {
- bestEntDmg = (100000.f - fabs(g_Math.Distance(Vector2D(g::pLocalEntity->GetOrigin().x, g::pLocalEntity->GetOrigin().y), Vector2D(pEnt->GetOrigin().x, pEnt->GetOrigin().y))));
- Backtrack[pEnt->EntIndex()] = true;
- return pEnt->GetHitboxPosition(HITBOX_HEAD, pPlayerEntityRecord.Matrix);
- }
- return Vector(0, 0, 0);
- }
- void Aimbot::OnCreateMove()
- {
- if (!g::pLocalEntity || !g_pEngine->IsInGame())
- return;
- Vector Aimpoint = { 0,0,0 };
- C_BaseEntity* Target = nullptr;
- int targetID = 0;
- int tempDmg = 0;
- static bool shot = false;
- for (int i = 0; i <= g_pEngine->GetMaxClients(); ++i)
- {
- C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(i);
- if (!pPlayerEntity
- || !pPlayerEntity->IsAlive()
- || pPlayerEntity->IsDormant()
- || pPlayerEntity == g::pLocalEntity
- || pPlayerEntity->GetTeam() == g::pLocalEntity->GetTeam())
- {
- g_LagComp.ClearRecords(i);
- continue;
- }
- g_LagComp.StoreRecord(pPlayerEntity);
- if (pPlayerEntity == g::pLocalEntity || pPlayerEntity->GetTeam() == g::pLocalEntity->GetTeam())
- continue;
- g::EnemyEyeAngs[i] = pPlayerEntity->GetEyeAngles();
- if (g_LagComp.PlayerRecord[i].size() == 0 || !g::pLocalEntity->IsAlive() || !g_Menu.Config.Aimbot)
- continue;
- if (!g::pLocalEntity->IsAlive() || !g::pLocalEntity->GetActiveWeapon() || g::pLocalEntity->IsKnifeorNade())
- continue;
- bestEntDmg = 0;
- Vector Hitbox = Hitscan(pPlayerEntity);
- if (Hitbox != Vector(0, 0, 0) && tempDmg <= bestEntDmg)
- {
- Aimpoint = Hitbox;
- Target = pPlayerEntity;
- targetID = Target->EntIndex();
- tempDmg = bestEntDmg;
- }
- }
- if (!g::pLocalEntity->IsAlive())
- {
- shot = false;
- return;
- }
- if (shot)
- {
- if (g_Menu.Config.FixShotPitch) // ik it dosnt realy fix much just makes ur pitch go down faster
- {
- g::bSendPacket = true;
- g_AntiAim.OnCreateMove();
- }
- shot = false;
- }
- float flServerTime = g::pLocalEntity->GetTickBase() * g_pGlobalVars->intervalPerTick;
- bool canShoot = (g::pLocalEntity->GetActiveWeapon()->GetNextPrimaryAttack() <= flServerTime);
- if (Target)
- {
- g::TargetIndex = targetID;
- float SimulationTime = 0.f;
- if (Backtrack[targetID])
- SimulationTime = g_LagComp.PlayerRecord[targetID].at(0).SimTime;
- else
- SimulationTime = g_LagComp.PlayerRecord[targetID].at(g_LagComp.PlayerRecord[targetID].size() - 1).SimTime;
- if (ShotBacktrack[targetID])
- SimulationTime = g_LagComp.PlayerRecord[targetID].at(g_LagComp.ShotTick[targetID]).SimTime;
- bool validbSendPacket = true;
- if (g_Menu.Config.OneTickChoke && g::bSendPacket && g_Menu.Config.Fakelag != 0)
- validbSendPacket = false;
- Vector Angle = g_Math.CalcAngle(g::pLocalEntity->GetEyePosition(), Aimpoint);
- if (g::pLocalEntity->GetVelocity().Length() >= (g::pLocalEntity->GetActiveWeapon()->GetCSWpnData()->max_speed_alt * .34f) - 5 && !GetAsyncKeyState(VK_SPACE))
- Autostop();
- if (!(g::pCmd->buttons & IN_ATTACK) && canShoot && HitChance(Target, g::pLocalEntity->GetActiveWeapon(), Angle, Aimpoint, g_Menu.Config.HitchanceValue) && validbSendPacket)
- {
- if (!Backtrack[targetID] && !ShotBacktrack[targetID])
- g::Shot[targetID] = true;
- g::Shot[g::TargetIndex] = true;
- g::bSendPacket = true;
- if (g_Menu.Config.ChokeShotOnPeek && g::LagPeek && !g_Menu.Config.OneTickChoke)
- g::bSendPacket = false;
- if (g_Menu.Config.OneTickChoke)
- {
- shot = true;
- g::bSendPacket = false;
- }
- g::bSendPacket = true;
- shot = true;
- g::pCmd->viewangles = Angle - (g::pLocalEntity->GetAimPunchAngle() * g_pCvar->FindVar("weapon_recoil_scale")->GetFloat());
- g::pCmd->buttons |= IN_ATTACK;
- g::pCmd->tick_count = TIME_TO_TICKS(Target->GetSimulationTime() + g_LagComp.LerpTime());
- }
- }
- }
- template<class T, class U>
- T Aimbot::clamp(T in, U low, U high)
- {
- if (in <= low)
- return low;
- if (in >= high)
- return high;
- return in;
- }
- /*int bestHitbox = -1, mostDamage;
- Vector multipoints[128];
- int multipointCount = 0;
- bool lag_comp;
- #define clamp(val, min, max) (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val)))
- float CAimbot::seedchance(Vector Point)//what do you mean
- {
- if (!g::pLocalEntity)
- return 0;
- C_BaseCombatWeapon *weapon = (C_BaseCombatWeapon*)g::pLocalEntity->GetActiveWeapon();
- if (!weapon)
- return 0;
- float SpreadCone = weapon->GetAccuracyPenalty() * 256.0f / M_PI + weapon->GetCSWpnData()->max_speed * g::pLocalEntity->GetVelocity().Length() / 3000.0f;
- Vector local_position = g::pLocalEntity->GetOrigin() + g::pLocalEntity->GetViewOffset();
- float a = (Point - local_position).Length();
- float b = sqrt(tan(SpreadCone * M_PI / 180.0f) * a);
- if (2.2f > b) return 100.0f;
- return (2.2f / fmax(b, 2.2f)) * 100.0f;
- }
- void CAimbot::run_aimbot()
- {
- Entities.clear();
- SelectTarget();
- shoot_enemy();
- }
- void CAimbot::SelectTarget()
- {
- if (!g::pLocalEntity) return;
- for (int index = 1; index <= 65; index++)
- {
- auto entity = g_pEntityList->GetClientEntity(index);
- if (!entity) continue;
- if (entity->GetTeam() == g::pLocalEntity->GetTeam()) continue;
- if (entity->GetHealth() <= 0) continue;
- if (entity->GetClientClass()->ClassID != 38) continue;
- if (entity->GetOrigin() == Vector(0, 0, 0)) continue;
- if (entity->IsImmune()) continue;
- if (entity->GetIsDormant()) continue;
- AimbotData_t data = AimbotData_t(entity, index);
- Entities.push_back(data);
- }
- }
- void CAimbot::auto_revolver()
- {
- if (!g::pLocalEntity && g::pLocalEntity->GetHealth() <= 0) return;
- C_BaseCombatWeapon *weapon = (C_BaseCombatWeapon*)g::pLocalEntity->GetActiveWeapon();
- if (!weapon || weapon->GetAmmo() == 0) return;
- if (weapon->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_REVOLVER) {
- g::pCmd->buttons |= IN_ATTACK;
- float flPostponeFireReady = weapon->GetPostponeFireReadyTime();
- if (flPostponeFireReady > 0 && flPostponeFireReady < g_pGlobalVars->curtime) {
- g::pCmd->buttons &= ~IN_ATTACK;
- }
- }
- }
- void CAimbot::shoot_enemy()
- {
- if (!g::pLocalEntity || g::pLocalEntity->GetHealth() <= 0) return;
- C_BaseCombatWeapon *weapon = (C_BaseCombatWeapon*)g::pLocalEntity->GetActiveWeapon();
- if (!weapon || weapon->GetAmmo() == 0) return;
- if (weapon->GetCSWpnData()->type == 9) return;
- float flServerTime = g::pLocalEntity->GetTickBase() * g_pGlobalVars->intervalPerTick;
- bool canShoot = (g::pLocalEntity->GetActiveWeapon()->GetNextPrimaryAttack() <= flServerTime);
- if (weapon->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_C4 || g::pLocalEntity->IsKnifeorNade()) return;
- if (!canShoot) { g::pCmd->buttons &= ~IN_ATTACK; return; }
- if (GetAsyncKeyState(VK_LBUTTON)) return;
- Vector aim_angles;
- for (auto players : Entities)
- {
- auto entity = players.pPlayer;
- auto class_id = entity->GetClientClass()->ClassID;
- if (!entity)
- continue;
- if (entity->GetTeam() == g::pLocalEntity->GetTeam())
- continue;
- if (entity->GetHealth() <= 0)
- continue;
- if (class_id != 38)
- continue;
- if (entity->GetOrigin() == Vector(0, 0, 0))
- continue;
- if (entity->IsImmune())
- continue;
- if (entity->GetIsDormant())
- continue;
- Vector where2Shoot;
- if (g_Menu.Config.MultiPoint) where2Shoot = aimbot->full_multipoint(entity);
- else where2Shoot = aimbot->full_point(entity);
- if (where2Shoot == Vector(0, 0, 0)) continue;
- if (g::pLocalEntity->GetVelocity().Length() >= (g::pLocalEntity->GetActiveWeapon()->GetCSWpnData()->max_speed_alt * .34f) - 5 && !GetAsyncKeyState(VK_SPACE))
- Autostop();
- aim_angles = g_Math.NormalizeAngle(g_Math.CalcAngle(g::pLocalEntity->GetEyePosition(), where2Shoot));
- if (aim_angles == Vector(0, 0, 0)) continue;
- if (weapon->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_AWP || weapon->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_SSG08 ||
- weapon->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_SCAR20 || weapon->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_G3SG1 ||
- weapon->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_AUG || weapon->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_SG556)
- if (!g::pLocalEntity->IsScoped())
- g::pCmd->buttons |= IN_ATTACK2;
- auto_revolver();
- Vector vec_position[65], origin_delta[65];
- if (entity->GetOrigin() != vec_position[entity->GetIndex()])
- {
- origin_delta[entity->GetIndex()] = entity->GetOrigin() - vec_position[entity->GetIndex()];
- vec_position[entity->GetIndex()] = entity->GetOrigin();
- lag_comp = fabs(origin_delta[entity->GetIndex()].Length()) > 64;
- }
- if (lag_comp && entity->GetVelocity().Length2D() > 300 && g_Menu.Config.DelayShot1 == 1) return;
- if (accepted_inaccuracy(weapon) < g_Menu.Config.HitchanceValue1) continue;
- if (g_LagComp.ValidTick(TIME_TO_TICKS(entity->GetSimulationTime() + g_LagComp.LerpTime())))
- g::pCmd->tick_count = TIME_TO_TICKS(entity->GetSimulationTime() + g_LagComp.LerpTime());
- g::pCmd->buttons |= IN_ATTACK;
- break;
- }
- if (g::pCmd->buttons & IN_ATTACK)
- {
- float recoil_scale = g_pCvar->FindVar("weapon_recoil_scale")->GetFloat(); g::bSendPacket = true;
- aim_angles -= g::pLocalEntity->GetAimPunchAngle() * recoil_scale; g::pCmd->viewangles = aim_angles;
- }
- }
- float CAimbot::accepted_inaccuracy(C_BaseCombatWeapon* weapon) //ayyyyyywareeee
- {
- if (!g::pLocalEntity) return 0;
- if (!weapon) return 0;
- if (weapon->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_TASER) return 0;
- float inaccuracy = weapon->GetInaccuracy();
- if (inaccuracy == 0) inaccuracy = 0.0000001;
- inaccuracy = 1 / inaccuracy;
- return inaccuracy;
- }
- bool CAimbot::meets_requirements(C_BaseEntity* entity)
- {
- //is the aimbot targeted on this enemy
- return true;
- }
- int CAimbot::select_target()
- {
- //finds a target based on distance
- return 0;
- }
- std::vector<Vector> CAimbot::GetMultiplePointsForHitbox(C_BaseEntity* local, C_BaseEntity* entity, int iHitbox, matrix3x4_t BoneMatrix[128])
- {
- auto VectorTransform_Wrapper = [](const Vector& in1, const matrix3x4_t &in2, Vector &out)
- {
- auto VectorTransform = [](const float *in1, const matrix3x4_t& in2, float *out)
- {
- auto DotProducts = [](const float *v1, const float *v2)
- {
- return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
- };
- out[0] = DotProducts(in1, in2[0]) + in2[0][3];
- out[1] = DotProducts(in1, in2[1]) + in2[1][3];
- out[2] = DotProducts(in1, in2[2]) + in2[2][3];
- };
- VectorTransform(&in1.x, in2, &out.x);
- };
- studiohdr_t* pStudioModel = g_pModelInfo->GetStudiomodel(entity->GetModel());
- mstudiohitboxset_t* set = pStudioModel->GetHitboxSet(0);
- mstudiobbox_t *hitbox = set->GetHitbox(iHitbox);
- std::vector<Vector> vecArray;
- Vector max;
- Vector min;
- VectorTransform_Wrapper(hitbox->max, BoneMatrix[hitbox->bone], max);
- VectorTransform_Wrapper(hitbox->min, BoneMatrix[hitbox->bone], min);
- auto center = (min + max) * 0.5f;
- Vector CurrentAngles = g_Math.CalcAngle(center, local->GetEyePosition());
- Vector Forward;
- g_Math.AngleVectors(CurrentAngles, &Forward);
- Vector Right = Forward.Cross(Vector(0, 0, 1));
- Vector Left = Vector(-Right.x, -Right.y, Right.z);
- Vector Top = Vector(0, 0, 1);
- Vector Bot = Vector(0, 0, -1);
- switch (iHitbox) {
- case 0:
- for (auto i = 0; i < 4; ++i)
- {
- vecArray.emplace_back(center);
- }
- vecArray[1] += Top * (hitbox->radius * g_Menu.Config.HeadScale1);
- vecArray[2] += Right * (hitbox->radius * g_Menu.Config.HeadScale1);
- vecArray[3] += Left * (hitbox->radius * g_Menu.Config.HeadScale1);
- break;
- default:
- for (auto i = 0; i < 3; ++i)
- {
- vecArray.emplace_back(center);
- }
- vecArray[1] += Right * (hitbox->radius * g_Menu.Config.BodyScale1);
- vecArray[2] += Left * (hitbox->radius * g_Menu.Config.BodyScale1);
- break;
- }
- return vecArray;
- }
- Vector CAimbot::full_multipoint(C_BaseEntity* entity)
- {
- C_BaseCombatWeapon *weapon = (C_BaseCombatWeapon*)g::pLocalEntity->GetActiveWeapon();
- if (!g::pLocalEntity)
- return Vector(0, 0, 0);
- Vector local_position = g::pLocalEntity->GetOrigin() + g::pLocalEntity->GetViewOffset();
- Vector vector_best_point = Vector(0, 0, 0);
- float damage_val;
- if (weapon->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_SSG08)
- {
- damage_val = g_Menu.Config.MinDmgScout; //lol idk why, its pasted anyway so w/e
- }
- else if (weapon->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_SCAR20 || weapon->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_G3SG1)
- {
- damage_val = g_Menu.Config.MinDmgAuto; //lol idk why, its pasted anyway so w/e
- }
- else
- {
- damage_val = g_Menu.Config.MinDmgOther; //lol idk why, its pasted anyway so w/e
- }
- mostDamage = damage_val;
- matrix3x4_t matrix[128];
- if (!entity->SetupBones(matrix, 128, 256, 0))
- return Vector(0, 0, 0);
- int hitboxes[] =
- {
- HITBOX_HEAD,
- HITBOX_NECK,
- HITBOX_PELVIS,
- HITBOX_BELLY,
- HITBOX_THORAX,
- HITBOX_UPPER_CHEST,
- HITBOX_RIGHT_CALF,
- HITBOX_LEFT_CALF,
- HITBOX_RIGHT_FOOT,
- HITBOX_LEFT_FOOT,
- HITBOX_RIGHT_HAND,
- HITBOX_LEFT_HAND,
- HITBOX_RIGHT_THIGH,
- HITBOX_LEFT_THIGH,
- };
- for (int i = 0; i < ARRAYSIZE(hitboxes); i++)
- {
- for (auto point : GetMultiplePointsForHitbox(g::pLocalEntity, entity, hitboxes[i], matrix))
- {
- CGameTrace trace;
- int damage = g_AutoWall.CanHit(point);
- if (damage > mostDamage)
- {
- bestHitbox = hitboxes[i];
- mostDamage = damage;
- vector_best_point = point;
- if (mostDamage >= entity->GetHealth())
- return vector_best_point;
- }
- }
- }
- return vector_best_point;
- }
- Vector CAimbot::get_hitbox_pos(C_BaseEntity* entity, int hitbox_id)
- {
- auto getHitbox = [](C_BaseEntity* entity, int hitboxIndex) -> mstudiobbox_t*
- {
- if (entity->GetIsDormant() || entity->GetHealth() <= 0) return NULL;
- const auto pModel = entity->GetModel();
- if (!pModel) return NULL;
- auto pStudioHdr = g_pModelInfo->GetStudiomodel(pModel);
- if (!pStudioHdr) return NULL;
- auto pSet = pStudioHdr->GetHitboxSet(0);
- if (!pSet) return NULL;
- if (hitboxIndex >= pSet->numhitboxes || hitboxIndex < 0) return NULL;
- return pSet->GetHitbox(hitboxIndex);
- };
- auto hitbox = getHitbox(entity, hitbox_id);
- if (!hitbox) return Vector(0, 0, 0);
- auto bone_matrix = entity->GetBoneMatrix(hitbox->bone);
- Vector bbmin, bbmax;
- g_Math.VectorTransform(hitbox->min, bone_matrix, bbmin);
- g_Math.VectorTransform(hitbox->max, bone_matrix, bbmax);
- return (bbmin + bbmax) * 0.5f;
- }
- Vector CAimbot::full_point(C_BaseEntity* entity)
- {
- C_BaseCombatWeapon *weapon = (C_BaseCombatWeapon*)g::pLocalEntity->GetActiveWeapon();
- if (!g::pLocalEntity)
- return Vector(0, 0, 0);
- Vector local_position = g::pLocalEntity->GetOrigin() + g::pLocalEntity->GetViewOffset();
- Vector vector_best_point = Vector(0, 0, 0);
- int hitboxes[] =
- {
- HITBOX_HEAD,
- HITBOX_PELVIS,
- HITBOX_BELLY,
- HITBOX_THORAX,
- HITBOX_PELVIS,
- HITBOX_UPPER_CHEST,
- HITBOX_LEFT_FOOT,
- HITBOX_RIGHT_FOOT
- };
- float damage_val;
- if (weapon->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_SSG08)
- {
- damage_val = g_Menu.Config.MinDmgScout; //lol idk why, its pasted anyway so w/e
- }
- else if (weapon->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_SCAR20 || weapon->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_G3SG1)
- {
- damage_val = g_Menu.Config.MinDmgAuto; //lol idk why, its pasted anyway so w/e
- }
- else
- {
- damage_val = g_Menu.Config.MinDmgOther; //lol idk why, its pasted anyway so w/e
- }
- mostDamage = damage_val;
- for (int i = 0; i < ARRAYSIZE(hitboxes); i++)
- {
- int damage = g_AutoWall.CanHit(entity->GetBonePosition(hitboxes[i]));
- if (damage > mostDamage)
- {
- bestHitbox = hitboxes[i];
- mostDamage = damage;
- vector_best_point = get_hitbox_pos(entity, bestHitbox);
- if (mostDamage >= entity->GetHealth())
- return vector_best_point;
- }
- }
- return vector_best_point;
- }
- CAimbot* aimbot = new CAimbot();*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement