[go: up one dir, main page]

0% found this document useful (0 votes)
300 views2 pages

Aim Lock

The document contains code for an aimbot in C++. It includes functions for looking at a player, getting the angle to a player, and locking onto a target player. The code handles different aimbot targets and does not aim if the player has a knife or unscoped sniper equipped.

Uploaded by

adityafarras499
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
300 views2 pages

Aim Lock

The document contains code for an aimbot in C++. It includes functions for looking at a player, getting the angle to a player, and locking onto a target player. The code handles different aimbot targets and does not aim if the player has a knife or unscoped sniper equipped.

Uploaded by

adityafarras499
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include "AimAssist.

h"
#include "Triggerbot.h"

bool AimLock::WasOnEnemy = false;


QAngle LastAngle = QAngle(0, 0, 0);

float GetAngleDelta()
{
QAngle ViewAngles;
Interfaces::Engine()->GetViewAngles(ViewAngles);
ViewAngles -= LastAngle;
Utils::Clamp(ViewAngles);
return Vector(ViewAngles.x, ViewAngles.y, ViewAngles.z).Length();
}

float GetRelativeFOVAngle(int PlayerID)


{
if (!PlayerID) return 180.0f;
auto pLocal = C_CSPlayer::GetLocalPlayer();
auto Target = static_cast<C_CSPlayer*>(SourceEngine::Interfaces::EntityList()-
>GetClientEntity(PlayerID));
QAngle TargetAngles = (Target->GetOrigin() - pLocal->GetOrigin()).Angle();
QAngle ViewAngles;
Interfaces::Engine()->GetViewAngles(ViewAngles);
TargetAngles -= ViewAngles;
Utils::Clamp(TargetAngles);
return Vector(TargetAngles.x, TargetAngles.y, TargetAngles.z).Length();
}

void AimLock::LookAtPlayer(int PlayerID, SourceEngine::CUserCmd* pCmd)


{
if (!PlayerID) return;
auto pLocal = C_CSPlayer::GetLocalPlayer();
auto ActiveWeapon = pLocal->GetActiveWeapon();

auto Target = static_cast<C_CSPlayer*>(SourceEngine::Interfaces::EntityList()-


>GetClientEntity(PlayerID));
SourceEngine::Vector AimPos = SourceEngine::Vector(0, 0, 0);
if (Config.g_iAimbotTarget == 0)
AimPos = Target->GetHeadCenterPos();
else if (Config.g_iAimbotTarget == 1)
AimPos = Target->GetBoneByName(XorStr("spine_3"));
else if (Config.g_iAimbotTarget == 2)
AimPos = Target->GetBoneByName(XorStr("spine_0"));

pCmd->viewangles = (AimPos - pLocal->GetEyePos()).Angle();


pCmd->viewangles -= RCS::GetCurrentPunchAngles();

if (!Config.g_iViewMode)
Interfaces::Engine()->SetViewAngles(pCmd->viewangles);
}

void AimLock::LookAtPoint(SourceEngine::Vector Point, SourceEngine::CUserCmd* pCmd)


{
auto pLocal = C_CSPlayer::GetLocalPlayer();
auto ActiveWeapon = pLocal->GetActiveWeapon();

SourceEngine::QAngle Angle = (Point - pLocal->GetEyePos()).Angle();


Utils::Clamp(Angle);
pCmd->viewangles = Angle;
pCmd->viewangles -= RCS::GetCurrentPunchAngles();
}

void AimLock::LockOnTarget(int PlayerID, SourceEngine::CUserCmd* pCmd)


{
auto ActiveWeapon = C_CSPlayer::GetLocalPlayer()->GetActiveWeapon();
if (ActiveWeapon->IsKnife()) return;
if (ActiveWeapon->IsSniper() && !(C_CSPlayer::GetLocalPlayer()->IsScoped()))
return;
LookAtPlayer(PlayerID, pCmd);
SourceEngine::Interfaces::Engine()->SetViewAngles(pCmd->viewangles);
}

void AimLock::Think(SourceEngine::CUserCmd* pCmd)


{
auto pLocal = C_CSPlayer::GetLocalPlayer();
int PlayerID = pLocal->InCross();
if (PlayerID)
{
if (!WasOnEnemy &&
Utils::IsViableTarget(static_cast<C_CSPlayer*>(SourceEngine::Interfaces::EntityList
()->GetClientEntity(pLocal->InCross()))))
AimLock::LockOnTarget(pLocal->InCross(), pCmd);
}
}

You might also like