-
Автор темы
- #1
Помогите доделать блок бот
C++:
auto m_local = g_LocalPlayer;
float bestdist = 150.f;
int index = -1;
if (GetAsyncKeyState(g_Options.block_bot_key)) {
for (int i = 0; i < g_EntityList->GetHighestEntityIndex(); i++) {
auto entity = C_BasePlayer::GetPlayerByIndex(i);
if (!entity) continue;
if (!entity->IsAlive() || entity->IsDormant() || entity == m_local) continue;
float dist = (m_local->m_vecOrigin() - entity->m_vecOrigin()).Length();
if (dist < bestdist) {
bestdist = dist;
index = i;
}
}
}
if (index == -1) return;
auto target = C_BasePlayer::GetPlayerByIndex(index);
if (!target) return;
QAngle angles = Math::CalcAngle(m_local->GetEyePos(), target->GetEyePos());
angles.Normalize();
if (angles.yaw < 0.0f) cmd->sidemove = 450.f;
else if (angles.yaw > 0.0f) cmd->sidemove = -450.f;