STR
01-11-07, 06:13
Basic
first we need a function to find the distance between ourselves and the target ent
float cEntity::flGetDistance( int index )
{
IClientEntity* pEntity = main.m_pEntList->GetClientEntity( index );
if (pEntity == NULL )
return 999999.0f;
return flGetDistance( pEntity->GetAbsOrigin() );
}
float cEntity::flGetDistance( Vector vPlayer )
{
IClientEntity* pEntity = main.m_pEntList->GetClientEntity( main.m_pEngine->GetLocalPlayer() );
if ( pEntity == NULL )
return 999999.0f;
Vector vDeltaOrigin = vPlayer - pEntity->GetAbsOrigin();
return sqrtf( vDeltaOrigin.Length() );
}
now we need to set when to stab
bool cCAimbot::CanStab()
{
flBestDist = main.m_pEntity->flGetDistance( vPlayer );
if(cvars.knifebot_stab_distance > flBestDist)//or u can perfect this manualy
return true;
return false;
}
then in your aiming function:
if(cvars.knifebot == 1 && gWeapon.IsCurWepKnife() && CanStab())
cmd->buttons = IN_ATTACK2;
credits: hlh(distance func)
first we need a function to find the distance between ourselves and the target ent
float cEntity::flGetDistance( int index )
{
IClientEntity* pEntity = main.m_pEntList->GetClientEntity( index );
if (pEntity == NULL )
return 999999.0f;
return flGetDistance( pEntity->GetAbsOrigin() );
}
float cEntity::flGetDistance( Vector vPlayer )
{
IClientEntity* pEntity = main.m_pEntList->GetClientEntity( main.m_pEngine->GetLocalPlayer() );
if ( pEntity == NULL )
return 999999.0f;
Vector vDeltaOrigin = vPlayer - pEntity->GetAbsOrigin();
return sqrtf( vDeltaOrigin.Length() );
}
now we need to set when to stab
bool cCAimbot::CanStab()
{
flBestDist = main.m_pEntity->flGetDistance( vPlayer );
if(cvars.knifebot_stab_distance > flBestDist)//or u can perfect this manualy
return true;
return false;
}
then in your aiming function:
if(cvars.knifebot == 1 && gWeapon.IsCurWepKnife() && CanStab())
cmd->buttons = IN_ATTACK2;
credits: hlh(distance func)