Если кому нужен, то забирайте совершенно бесплатно!
Код
void AutoDefuse(CBaseEntity* pLocal, CInput::CUserCmd* pCmd)
{
// Abort if you are not a counter-terrorist //
if (!(pLocal->GetTeam() == 3))
return;
// Loop through entities in the world //
for (int i = 1; i < CInterfaces::g_pEntList->GetHighestEntityIndex(); i++)
{
// Saving the entity for use //
CBaseEntity* pEntity = CInterfaces::g_pEntList->GetClientEntity(i);
// Continue if the entity exists //
if (!pEntity)
continue;
// Pretty self-explanatory //
if (pEntity->IsDormant())
continue;
// Filter entities to get the planted bomb //
if (pEntity->GetClientClass()->GetClassID() != CPlantedC4)
continue;
// Making sure that the bomb is not already defused //
if (pEntity->IsBombDefused())
continue;
// Retrieve the distance from you to the bomb //
float fDistance = g_pMath.GetDistance(pLocal->GetAbsOrigin(), pEntity->GetAbsOrigin());
// Continue if you are within a reasonable distance & field of view //
if (fDistance <= 6.5f)
{
// Defuse the bomb derp //
pCmd->buttons |= IN_USE;
}
}
}