-
Автор темы
- #1
C++:
void Visuals::DrawPlayer(Player* player) {
auto cfg = g_menu.main.players;
if ( !player->enemy( g_cl.m_local ) )
return;
int i = player->index( );
if ( ( !player->alive( ) && m_alpha[ i ] <= 0.f ) || player->m_iTeamNum( ) == g_cl.m_local->m_iTeamNum( ) ) {
if ( player->alive( ) ) {
m_alpha[ i ] = 155.f;
}
return;
}
Rect bbox;
if ( !GetPlayerBoxRect( player, bbox ) && player->alive( ) ) {
OffScreen( player, m_alpha[ i ] );
return;
}
m_bbox[ i ] = bbox;
if ( !player->alive( ) ) {
m_alpha[ i ] -= 480.f * g_csgo.m_globals->m_frametime;
}
else if ( player->dormant( ) ) {
m_alpha[ i ] -= 20.f * g_csgo.m_globals->m_frametime;
}
else {
m_alpha[ i ] += 240.f * g_csgo.m_globals->m_frametime;
}
m_alpha[ i ] = std::clamp( m_alpha[ i ], 0.f, 255.f );
player_info_t info;
if ( !g_csgo.m_engine->GetPlayerInfo( i, &info ) )
return;
bool box_esp = cfg.esp_elements.get( 0 );
bool name_esp = cfg.esp_elements.get( 1 );
bool health_esp = cfg.esp_elements.get( 2 );
bool ammobr = cfg.esp_elements.get( 4 );
bool lbybar = cfg.esp_elements.get( 5 );
bool bone_esp = cfg.esp_elements.get( 8 );
if ( bone_esp )
DrawSkeleton( player, m_alpha[ i ] );
if ( name_esp ) {
std::string name{ std::string( info.m_name ).substr( 0, 24 ) };
Color clr = g_menu.main.players.name_color.get( );
clr.a( ) *= m_alpha[ i ] / 255.f;
render::esp.string( bbox.x + bbox.w / 2, bbox.y - render::esp.m_size.m_height, !player->dormant( ) ? clr : Color( 141, 141, 141, int( m_alpha[ i ] ) ), name, render::ALIGN_CENTER );
}
if ( box_esp ) {
Color clr = g_menu.main.players.box_enemy.get( );
clr.a( ) *= m_alpha[ i ] / 255.f;
render::rect( bbox.x + 1, bbox.y + 1, bbox.w, bbox.h, Color( 10, 10, 10, int( m_alpha[ i ] / 2.f ) ) );
render::rect( bbox.x, bbox.y, bbox.w, bbox.h, !player->dormant( ) ? clr : Color( 141, 141, 141, int( m_alpha[ i ] ) ) );
}
if ( health_esp ) {
int y = bbox.y + 1;
int h = bbox.h - 2;
int hp = std::min( 100, player->m_iHealth( ) );
if ( m_hp[ player->index( ) ] > hp )
m_hp[ player->index( ) ] -= 200.f * g_csgo.m_globals->m_frametime;
else
m_hp[ player->index( ) ] = hp;
hp = m_hp[ player->index( ) ];
// calculate hp bar color.
int r = std::min( ( 510 * ( 100 - hp ) ) / 100, 255 );
int g = std::min( ( 510 * hp ) / 100, 255 );
auto hp_clr = Color( r, g, 0 );
hp_clr.a( ) *= m_alpha[ i ] / 255.f;
int fill = ( int )std::round( hp * h / 100.f );
render::rect_filled( bbox.x - 6, y - 1, 4, h + 2, { 50, 50, 50, int( m_alpha[ i ] / 2.f ) } );
render::rect( bbox.x - 6, y - 1, 4, h + 2, { 10, 10, 10, int( m_alpha[ i ] ) } );
render::rect( bbox.x - 5, y + h - fill, 2, fill, !player->dormant( ) ? hp_clr : Color( 141, 141, 141, int( m_alpha[ i ] ) ) );
if ( hp < 93 )
render::pixel.string( bbox.x - 5, y + ( h - fill ) - 5, !player->dormant( ) ? Color( 255, 255, 255, int( m_alpha[ i ] ) ) : Color( 141, 141, 141, int( m_alpha[ i ] ) ), std::to_string( hp ), render::ALIGN_CENTER );
}
/* bottom bars */
if ( player->alive( ) ) {
int offset{ 0 };
if ( lbybar ) {
AimPlayer* data = &g_aimbot.m_players[ player->index( ) - 1 ];
if ( data && data->m_records.size( ) >= 2 ) {
LagRecord* current = data->m_records.front( ).get( );
if ( current ) {
float cycle = std::clamp<float>( data->m_body_update - current->m_sim_time, 0.f, 1.0f );
float width = ( bbox.w * cycle ) / 1.1f;
if ( width > 0.f ) {
render::rect_filled( bbox.x, bbox.y + bbox.h + 2, bbox.w, 4, { 50, 50, 50, int( m_alpha[ i ] / 2.f ) } );
render::rect( bbox.x, bbox.y + bbox.h + 2, bbox.w, 4, { 10, 10, 10, int( m_alpha[ i ] ) } );
Color clr = g_menu.main.players.lby_update_color.get( );
clr.a( ) *= m_alpha[ i ] / 255.f;
render::rect( bbox.x + 1, bbox.y + bbox.h + 3, width, 2, !player->dormant( ) ? clr : Color( 141, 141, 141, int( m_alpha[ i ] ) ) );
offset += 6;
}
}
}
}
Weapon* weapon = player->GetActiveWeapon( );
if ( weapon ) {
WeaponInfo* data = weapon->GetWpnData( );
if ( data ) {
int bar;
float scale;
int max = data->m_max_clip1;
int current = weapon->m_iClip1( );
C_AnimationLayer* layer1 = &player->m_AnimOverlay( )[ 1 ];
bool reload = ( layer1->m_weight != 0.f ) && ( player->GetSequenceActivity( layer1->m_sequence ) == 967 );
if ( max != -1 && ammobr ) {
if ( reload )
scale = layer1->m_cycle;
else
scale = ( float )current / max;
bar = ( int )std::round( ( bbox.w - 2 ) * scale );
render::rect_filled( bbox.x, bbox.y + bbox.h + 2 + offset, bbox.w, 4, { 50, 50, 50, int( m_alpha[ i ] / 2.f ) } );
render::rect( bbox.x, bbox.y + bbox.h + 2 + offset, bbox.w, 4, { 10, 10, 10, int( m_alpha[ i ] ) } );
Color clr = g_menu.main.players.ammo_color.get( );
clr.a( ) *= m_alpha[ i ] / 255.f;
render::rect( bbox.x + 1, bbox.y + bbox.h + 3 + offset, bar, 2, !player->dormant( ) ? clr : Color( 141, 141, 141, int( m_alpha[ i ] ) ) );
if ( current <= ( int )std::round( max / 5 ) && !reload )
render::esp_small.string( bbox.x + bar, bbox.y + bbox.h + offset, !player->dormant( ) ? Color( 255, 255, 255, int( m_alpha[ i ] ) ) : Color( 141, 141, 141, int( m_alpha[ i ] ) ), std::to_string( current ), render::ALIGN_CENTER );
offset += 8;
}
if ( cfg.esp_elements.get( 3 ) ) {
std::string name{ weapon->GetLocalizedName( ) };
Color clr = Color( 255, 255, 255 );//config[ "esp_wpnt_clr" ].get_color( );
clr.a( ) *= m_alpha[ i ] / 255.f;
std::transform( name.begin( ), name.end( ), name.begin( ), ::toupper );
render::small_pix.string( bbox.x + bbox.w / 2, bbox.y + bbox.h + offset, !player->dormant( ) ? clr : Color( 141, 141, 141, int( m_alpha[ i ] ) ),
name + " [" + std::to_string( current ) + "/" + std::to_string(max) + "]", render::ALIGN_CENTER );
offset += 13;
}
}
}
}
{ // flags. -> that should work i dont care fuck it
std::vector< std::pair< std::string, Color > > flags;
AimPlayer* data = &g_aimbot.m_players[ player->index( ) - 1 ];
if ( cfg.flags_enemy.get( 0 ) ) {
if ( data->m_records.empty( ) )
return;
LagRecord* current = data->m_records.front( ).get( );
if ( current ) {
if ( !current->m_resolver_mode.empty( ) ) {
flags.push_back( { current->m_resolver_mode, current->m_resolver_color.alpha( int( m_alpha[ i ] ) ) } );
}
}
}
if ( cfg.flags_enemy.get( 1 ) ) {
// helmet and kevlar.
if ( player->m_bHasHelmet( ) && player->m_ArmorValue( ) > 0 )
flags.push_back( { XOR( "HK" ), { 255, 255, 255, int( m_alpha[ i ] ) } } );
// only helmet.
else if ( player->m_bHasHelmet( ) )
flags.push_back( { XOR( "H" ), { 255, 255, 255, int( m_alpha[ i ] ) } } );
// only kevlar.
else if ( player->m_ArmorValue( ) > 0 )
flags.push_back( { XOR( "K" ), { 255, 255, 255, int( m_alpha[ i ] ) } } );
}
if ( cfg.flags_enemy.get( 2 ) ) {
flags.push_back( { XOR( "ZOOM" ), { 60, 180, 225, int( m_alpha[ i ] ) } } );
}
// iterate flags.
for ( size_t i{ }; i < flags.size( ); ++i ) {
// get flag job (pair).
const auto& f = flags[ i ];
int offset = i * ( render::esp_small.m_size.m_height - 1 );
// draw flag.
render::esp_small.string( bbox.x + bbox.w + 2, bbox.y + offset, f.second, f.first );
}
}
}