Пользователь
-
Автор темы
- #1
просто юзлес говно,смысл? его нету тут
Код:
void AutoBlocker::OnCreateMove( CUserCmd* cmd )
{
if(!g_Options.mics_auto_block)
return;
float bestdist = 250.f;
int index = -1;
for( int i = 0; i < g_GlobalVars->maxClients; i++ )
{
C_BasePlayer* entity = reinterpret_cast<C_BasePlayer*>(g_EntityList->GetClientEntity(i));
if( !entity )
continue;
if( !entity->IsAlive() || entity->IsDormant() || entity == g_LocalPlayer)
continue;
float dist = Math::VectorDistance( g_LocalPlayer->m_vecOrigin(), entity->m_vecOrigin() );
if( dist < bestdist )
{
bestdist = dist;
index = i;
}
}
if( index == -1 )
return;
C_BasePlayer* target = reinterpret_cast<C_BasePlayer*>(g_EntityList->GetClientEntity( index ));
if( !target )
return;
QAngle angles = Math::CalcAngle( g_LocalPlayer->m_vecOrigin(), target->m_vecOrigin() );
angles.yaw -= g_LocalPlayer->m_angEyeAngles().yaw;
angles.Normalize();
if( angles.yaw < 0.0f )
cmd->sidemove = 450.f;
else if( angles.yaw > 0.0f )
cmd->sidemove = -450.f;
}