-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Сделал аимбот,но он стреляет себе под ноги иногда попадает,помогите!!!!
void Run4ik(CUserCmd* pCmd, CCSPlayerController* pLocalController, C_CSPlayerPawn* pLocalPawn)
{
float maxAimDist = 100000;
float max_fov = 180;
if (pLocalPawn->GetHealth() == 0)
return;
CBaseUserCmdPB* pBaseCmd = pCmd->pBaseCmd;
if (pBaseCmd == nullptr)
return;
Vector_t eyePos = pLocalPawn->GetSceneOrigin();
eyePos += pLocalPawn->GetViewOffset();
bool found = false;
Vector_t enemyEyePos;
QAngle_t relAngle;
QAngle_t finalAngle;
QAngle_t viewAngle = pBaseCmd->pCmdView->angValue;
const int nHighestIndex = I::GameResourceService->pGameEntitySystem->GetHighestEntityIndex();
for (int i = 1; i < nHighestIndex; ++i)
{
C_BaseEntity* e = I::GameResourceService->pGameEntitySystem->Get(i);
if (e == nullptr)
continue;
if (!pLocalController->IsPawnAlive())
continue;
auto pPawn = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(i);
if (pPawn == nullptr)
continue;
if (!pPawn->IsOtherEnemy(pLocalPawn))
continue;
if (pPawn->GetHealth() == 0)
continue;
Vector_t currentEnemyEyePos = pPawn->GetSceneOrigin() + pPawn->GetViewOffset();
float dist = eyePos.DistTo(currentEnemyEyePos);
QAngle_t relAngle = (enemyEyePos - eyePos).ToAngles();
//relAngle.Clamp();
float fov = std::hypotf(relAngle.x, relAngle.y);
/* if (fov < max_fov) //FOV CHECK
{
found = true;
max_fov = fov;
enemyEyePos = currentEnemyEyePos;
finalAngle = relAngle;
}*/
if (dist < maxAimDist) //DISTANCE CHECK
{
found = true;
maxAimDist = dist;
enemyEyePos = currentEnemyEyePos;
finalAngle = relAngle;
}
}
if (found)
{
//viewAngle += finalAngle;
pCmd->SetSubTickAngle(finalAngle);
//pBaseCmd->pCmdView->angValue = viewAngle;
//I::Input->SetViewAngle(pBaseCmd->pCmdView->angValue);
//pCmd->nButtons.nValue |= IN_ATTACK;
}
}
Пожалуйста, авторизуйтесь для просмотра ссылки.
void Run4ik(CUserCmd* pCmd, CCSPlayerController* pLocalController, C_CSPlayerPawn* pLocalPawn)
{
float maxAimDist = 100000;
float max_fov = 180;
if (pLocalPawn->GetHealth() == 0)
return;
CBaseUserCmdPB* pBaseCmd = pCmd->pBaseCmd;
if (pBaseCmd == nullptr)
return;
Vector_t eyePos = pLocalPawn->GetSceneOrigin();
eyePos += pLocalPawn->GetViewOffset();
bool found = false;
Vector_t enemyEyePos;
QAngle_t relAngle;
QAngle_t finalAngle;
QAngle_t viewAngle = pBaseCmd->pCmdView->angValue;
const int nHighestIndex = I::GameResourceService->pGameEntitySystem->GetHighestEntityIndex();
for (int i = 1; i < nHighestIndex; ++i)
{
C_BaseEntity* e = I::GameResourceService->pGameEntitySystem->Get(i);
if (e == nullptr)
continue;
if (!pLocalController->IsPawnAlive())
continue;
auto pPawn = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(i);
if (pPawn == nullptr)
continue;
if (!pPawn->IsOtherEnemy(pLocalPawn))
continue;
if (pPawn->GetHealth() == 0)
continue;
Vector_t currentEnemyEyePos = pPawn->GetSceneOrigin() + pPawn->GetViewOffset();
float dist = eyePos.DistTo(currentEnemyEyePos);
QAngle_t relAngle = (enemyEyePos - eyePos).ToAngles();
//relAngle.Clamp();
float fov = std::hypotf(relAngle.x, relAngle.y);
/* if (fov < max_fov) //FOV CHECK
{
found = true;
max_fov = fov;
enemyEyePos = currentEnemyEyePos;
finalAngle = relAngle;
}*/
if (dist < maxAimDist) //DISTANCE CHECK
{
found = true;
maxAimDist = dist;
enemyEyePos = currentEnemyEyePos;
finalAngle = relAngle;
}
}
if (found)
{
//viewAngle += finalAngle;
pCmd->SetSubTickAngle(finalAngle);
//pBaseCmd->pCmdView->angValue = viewAngle;
//I::Input->SetViewAngle(pBaseCmd->pCmdView->angValue);
//pCmd->nButtons.nValue |= IN_ATTACK;
}
}
Последнее редактирование: