void CAimbot::GetAimingPlayer()
{
iTargetPlayer = -1;
float fNearestDistance = 9999.0f;
// тут шлак бесполезный, смотри с нижнего комментария
if (g_Config.g_Aimbot.bAimbot || g_Config.g_Aimbot.bSmooth || g_Config.g_Aimbot.bSilent || g_Config.g_Aimbot.bProAim)
{
CVector vecCamera, vecOrigin, vecTarget;
Utils::getBonePosition(FindPlayerPed(), BONE_RIGHTWRIST, &vecOrigin);
TheCamera.Find3rdPersonCamTargetVector(100.f, vecOrigin, &vecCamera, &vecTarget);
for (int i = 0; i < SAMP_MAX_PLAYERS; i++)
{
if (!pSAMP->isPlayerStreamed(i))
continue;
CPed* pPed = CPools::GetPed(pSAMP->getPlayers()->pRemotePlayer[I]->pPlayerData->pSAMP_Actor->ulGTAEntityHandle);
if (!pPed || !pPed->IsAlive())
continue;
if (g_Config.g_Aimbot.bTeamProtect && pSAMP->getPlayerColor(i) == pSAMP->getPlayerColor(pSAMP->getPlayers()->sLocalPlayerID))
continue;
if (!g_Config.g_Aimbot.bIgnoreEverything)
{
if (g_Config.g_Aimbot.bIgnoreAFK && pSAMP->getPlayers()->pRemotePlayer[I]->pPlayerData->iAFKState == 2)
continue;
float fTargetDistance = Math::vect3_dist(&pSAMP->getPlayers()->pRemotePlayer[I]->pPlayerData->pSAMP_Actor->pGTA_Ped->base.matrix[12], &pSAMP->getPlayers()->pLocalPlayer->pSAMP_Actor->pGTA_Ped->base.matrix[12]);
if (!g_Config.g_Aimbot.bIgnoreMaxDistance && fTargetDistance > fWeaponRange[pSAMP->getPlayers()->pLocalPlayer->byteCurrentWeapon])
continue;
}
// Сам захват кости начинается отсюда
for (auto iBone : iBoneList)
{
CVector vecBone, vecBoneScreen;
Utils::getBonePosition(pPed, (ePedBones)iBone, &vecBone);
Utils::CalcScreenCoors(&vecBone, &vecBoneScreen);
if (vecBoneScreen.z < 1.0f)
continue;
float fCentreDistance = Math::vect2_dist(&vecCrosshair, &vecBoneScreen);
if (g_Config.g_Aimbot.bAimbot && fCentreDistance >= (float)g_Config.g_Aimbot.iAimbotConfig[pSAMP->getPlayers()->pLocalPlayer->byteCurrentWeapon][CRANGE] * 1.5f)
continue;
if (!g_Config.g_Aimbot.bIgnoreEverything && !g_Config.g_Aimbot.bLockThroughObjects && !CWorld::GetIsLineOfSightClear(vecCamera, vecBone, true, true, false, true, true, true, false))
continue;
if (fCentreDistance <= fNearestDistance)
{
fNearestDistance = fCentreDistance;
iTargetPlayer = i; iTargetBone = iBone;
vecTargetBone = vecBoneScreen;
break;
}
}
}
}
}