-
Автор темы
- #1
C++:
void CMisc::AutoZeus(CUserCmd* cmd)
{
if (!Vars.misc_AutoZeus)
return;
if (!g_LocalPlayer || !g_LocalPlayer->IsAlive())
return;
if (!g_LocalPlayer->m_hActiveWeapon())
return;
if (!g_LocalPlayer->m_hActiveWeapon()->IsZeus())
return;
float maxdist = 142;
float bestdist = 81;
int index = -1;
if (index == -1)
{
for (int i = 0; i < I::Engine->GetMaxClients(); i++)
{
C_BasePlayer* entity = (C_BasePlayer*)I::EntityList->GetClientEntity(i);
if (!entity) continue;
if (!entity->IsAlive() || entity->IsDormant() || entity == G::LocalPlayer || entity->IsTeammate()) continue;
float dist = (G::LocalPlayer->m_vecOrigin() - entity->m_vecOrigin()).Length();
if (dist < maxdist)
{
bestdist = dist;
index = i;
}
}
}
if (index == -1)
return;
C_BasePlayer * target = (C_BasePlayer*)I::EntityList->GetClientEntity(index);
if (!target)
return;
Vector traceStart, traceEnd;
trace_t tr;
QAngle viewAngles;
Interfaces::Engine->GetViewAngles(viewAngles);
QAngle viewAngles_rcs = viewAngles + Globals::LocalPlayer->m_aimPunchAngle() * 2.0f;
Math::AngleVectors(viewAngles_rcs, traceEnd);
traceStart = Globals::LocalPlayer->GetEyePos();
traceEnd = traceStart + (traceEnd * 8192.0f);
Utils::TraceLine(traceStart, traceEnd, 0x46004003, Globals::LocalPlayer, &tr);
static int g_iTimer = 0;
C_BasePlayer * Player = (C_BasePlayer*)tr.hit_entity;
if (Player && Player->GetClientClass()->m_ClassID == CCSPlayer && !Player->m_bGunGameImmunity() && tr.hitgroup)
{
if (!g_iTimer)
g_iTimer = GetTickCount();
if (GetTickCount() > g_iTimer + (Vars.misc_AutoZeus_Delay * 1000))
cmd->buttons |= IN_ATTACK;
}
else
g_iTimer = 0;
}
Vars.misc_AutoZeus_Delay - задержка перед выстрелом, float переменная в секундах (не мс)