Hello, does anyone have Better Freestanding everytime i peak out with supremacy freestand it almost always peak my head out
someone please help
Current Freestanding:
someone please help
Current Freestanding:
C++:
void HVH::AutoDirection( ) {
// constants.
constexpr float STEP{ 4.f };
constexpr float RANGE{ 32.f };
// best target.
struct AutoTarget_t { float fov; Player *player; };
AutoTarget_t target{ 180.f + 1.f, nullptr };
// iterate players.
for( int i{ 1 }; i <= g_csgo.m_globals->m_max_clients; ++i ) {
Player *player = g_csgo.m_entlist->GetClientEntity< Player * >( i );
// validate player.
if( !g_aimbot.IsValidTarget( player ) )
continue;
// skip dormant players.
if( player->dormant( ) )
continue;
// get best target based on fov.
float fov = math::GetFOV( g_cl.m_view_angles, g_cl.m_shoot_pos, player->WorldSpaceCenter( ) );
if( fov < target.fov ) {
target.fov = fov;
target.player = player;
}
}
if( !target.player ) {
// we have a timeout.
if( m_auto_last > 0.f && m_auto_time > 0.f && g_csgo.m_globals->m_curtime < ( m_auto_last + m_auto_time ) )
return;
// set angle to backwards.
m_auto = math::NormalizedAngle( m_view - 180.f );
m_auto_dist = -1.f;
return;
}
/*
* data struct
* 68 74 74 70 73 3a 2f 2f 73 74 65 61 6d 63 6f 6d 6d 75 6e 69 74 79 2e 63 6f 6d 2f 69 64 2f 73 69 6d 70 6c 65 72 65 61 6c 69 73 74 69 63 2f
*/
// construct vector of angles to test.
std::vector< AdaptiveAngle > angles{ };
angles.emplace_back( m_view - 180.f );
angles.emplace_back( m_view + 90.f );
angles.emplace_back( m_view - 90.f );
// start the trace at the enemy shoot pos.
vec3_t start = target.player->GetShootPosition( );
// see if we got any valid result.
// if this is false the path was not obstructed with anything.
bool valid{ false };
// iterate vector of angles.
for( auto it = angles.begin( ); it != angles.end( ); ++it ) {
// compute the 'rough' estimation of where our head will be.
vec3_t end{ g_cl.m_shoot_pos.x + std::cos( math::deg_to_rad( it->m_yaw ) ) * RANGE,
g_cl.m_shoot_pos.y + std::sin( math::deg_to_rad( it->m_yaw ) ) * RANGE,
g_cl.m_shoot_pos.z };
// draw a line for debugging purposes.
//g_csgo.m_debug_overlay->AddLineOverlay( start, end, 255, 0, 0, true, 0.1f );
// compute the direction.
vec3_t dir = end - start;
float len = dir.normalize( );
// should never happen.
if( len <= 0.f )
continue;
// step thru the total distance, 4 units per step.
for( float i{ 0.f }; i < len; i += STEP ) {
// get the current step position.
vec3_t point = start + ( dir * i );
// get the contents at this point.
int contents = g_csgo.m_engine_trace->GetPointContents( point, MASK_SHOT_HULL );
// contains nothing that can stop a bullet.
if( !( contents & MASK_SHOT_HULL ) )
continue;
float mult = 1.f;
// over 50% of the total length, prioritize this shit.
if( i > ( len * 0.5f ) )
mult = 1.25f;
// over 90% of the total length, prioritize this shit.
if( i > ( len * 0.75f ) )
mult = 1.25f;
// over 90% of the total length, prioritize this shit.
if( i > ( len * 0.9f ) )
mult = 2.f;
// append 'penetrated distance'.
it->m_dist += ( STEP * mult );
// mark that we found anything.
valid = true;
}
}
if( !valid ) {
// set angle to backwards.
m_auto = math::NormalizedAngle( m_view - 180.f );
m_auto_dist = -1.f;
return;
}
// put the most distance at the front of the container.
std::sort( angles.begin( ), angles.end( ),
[ ] ( const AdaptiveAngle &a, const AdaptiveAngle &b ) {
return a.m_dist > b.m_dist;
} );
// the best angle should be at the front now.
AdaptiveAngle *best = &angles.front( );
// check if we are not doing a useless change.
if( best->m_dist != m_auto_dist ) {
// set yaw to the best result.
m_auto = math::NormalizedAngle( best->m_yaw );
m_auto_dist = best->m_dist;
m_auto_last = g_csgo.m_globals->m_curtime;
}
}
Последнее редактирование: