Исходник DrawNetvars

Участник
Статус
Оффлайн
Регистрация
6 Апр 2021
Сообщения
343
Реакции[?]
216
Поинты[?]
122K
credits: soufiw
Код:
void DrawNetVars( C_CSPlayer* player ) {
   if ( player && !player->IsDead( ) ) {
      auto& pPropManager = Engine::PropManager::Instance( );
      auto cs_player = pPropManager->GetTable( XorStr( "DT_CSPlayer" ) );
      auto base_player = pPropManager->GetTable( XorStr( "DT_BasePlayer" ) );
      auto base_anim = pPropManager->GetTable( XorStr( "DT_BaseAnimating" ) );
      auto base_entity = pPropManager->GetTable( XorStr( "DT_BaseEntity" ) );
      auto DT_BaseCombatCharacter = pPropManager->GetTable( XorStr( "DT_BaseCombatCharacter" ) );
      auto DT_BaseFlex = pPropManager->GetTable( XorStr( "DT_BaseFlex" ) );

      struct cached_netvars {
         SendPropType m_RecvType;
         int offset;
         const char* name;
      };

      static std::vector<cached_netvars> netvars;
      static std::function<int( RecvTable * table )> add_all_netvars;
      add_all_netvars = [] ( RecvTable* table ) {
         int extra = 0;
         for ( int i = 0; i < table->m_nProps; i++ ) {
            auto prop = &table->m_pProps[ i ];
            auto child = prop->m_pDataTable;

            if ( child && child->m_nProps ) {
               int add = add_all_netvars( child );
               if(add)
                  extra += ( prop->m_Offset + add );
            } else if ( !isdigit( prop->m_pVarName[ 0 ] ) && prop->m_RecvType != DPT_Array && prop->m_RecvType != DPT_DataTable && prop->m_RecvType != DPT_String
                        && uint32_t( prop->m_Offset + extra ) > 0x40 ) {
               netvars.push_back( { prop->m_RecvType, prop->m_Offset + extra, prop->m_pVarName } );
            }
         }

         return extra;
      };

      //cs_player: 050
      if ( netvars.empty( ) ) {
         //add_all_netvars( cs_player );
         //add_all_netvars( DT_BaseCombatCharacter );
         add_all_netvars( DT_BaseFlex );
         //add_all_netvars( DT_BaseCombatCharacter );
      }

      Vector2D draw_pos = Vector2D( 200.0f, 10.0f );
      float biggestWidth = 0.0f;

      Render::Get( )->SetTextFont( FONT_VISITOR );

      for ( auto& net : netvars ) {
         static const auto MAX_BUFFER_SIZE = 4096;
         static char buffer[ MAX_BUFFER_SIZE ] = u8"";

         int kek = *( int* ) ( uintptr_t( player ) + net.offset );
         float kek2 = *( float* ) ( uintptr_t( player ) + net.offset );
         Vector kek3 = *( Vector* ) ( uintptr_t( player ) + net.offset );
         Vector2D kek4 = *( Vector2D* ) ( uintptr_t( player ) + net.offset );

         switch (net.m_RecvType) {
            case DPT_Int:
            // m_b
            if ( net.name[ 2 ] == XorStr( 'b' ) )
               sprintf_s( buffer, XorStr( "%s : %s [%X]" ), net.name, ( *( bool* ) ( uintptr_t( player ) + net.offset ) ) ? XorStr( "true" ) : XorStr( "false"), net.offset);
            else
               sprintf_s( buffer, XorStr( "%s : %d [%X]" ), net.name, kek, net.offset );
            break;
            case DPT_Float:
            sprintf_s( buffer, XorStr( "%s : %.5f [%X]" ), net.name, kek2, net.offset );
            break;
            case DPT_Vector:
            sprintf_s( buffer, XorStr( "%s : x %.5f y %.5f z %.5f [%X]" ), net.name, kek3.x, kek3.y, kek3.z, net.offset );
            break;
            case DPT_VectorXY:
            sprintf_s( buffer, XorStr( "%s : x %.5f y %.5f [%X]" ), net.name, kek4.x, kek4.y, net.offset );
            break;
            default:
            continue;
}

         Render::Get( )->AddText( draw_pos, 0xFFFFFFFF, OUTLINED, buffer );
         Vector2D size = Render::Get( )->CalcTextSize( buffer );
         biggestWidth = std::fmaxf( size.x, biggestWidth );

         draw_pos.y += size.y + 1.0f;
         if (draw_pos.y >= 1050.0f) {
            draw_pos.y = 10.0f;
            draw_pos.x += biggestWidth + 5.0f;
            biggestWidth = 0.0f;
         }
      }
   }
}
 
privates militärunternehmen "Überlegenheit"
Забаненный
Статус
Оффлайн
Регистрация
20 Сен 2023
Сообщения
152
Реакции[?]
113
Поинты[?]
23K
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
спасибо за пасту с сурса eexomi, очень полезно :whyRly:
 
Начинающий
Статус
Оффлайн
Регистрация
27 Сен 2023
Сообщения
28
Реакции[?]
5
Поинты[?]
7K
credits: soufiw
Код:
void DrawNetVars( C_CSPlayer* player ) {
   if ( player && !player->IsDead( ) ) {
      auto& pPropManager = Engine::PropManager::Instance( );
      auto cs_player = pPropManager->GetTable( XorStr( "DT_CSPlayer" ) );
      auto base_player = pPropManager->GetTable( XorStr( "DT_BasePlayer" ) );
      auto base_anim = pPropManager->GetTable( XorStr( "DT_BaseAnimating" ) );
      auto base_entity = pPropManager->GetTable( XorStr( "DT_BaseEntity" ) );
      auto DT_BaseCombatCharacter = pPropManager->GetTable( XorStr( "DT_BaseCombatCharacter" ) );
      auto DT_BaseFlex = pPropManager->GetTable( XorStr( "DT_BaseFlex" ) );

      struct cached_netvars {
         SendPropType m_RecvType;
         int offset;
         const char* name;
      };

      static std::vector<cached_netvars> netvars;
      static std::function<int( RecvTable * table )> add_all_netvars;
      add_all_netvars = [] ( RecvTable* table ) {
         int extra = 0;
         for ( int i = 0; i < table->m_nProps; i++ ) {
            auto prop = &table->m_pProps[ i ];
            auto child = prop->m_pDataTable;

            if ( child && child->m_nProps ) {
               int add = add_all_netvars( child );
               if(add)
                  extra += ( prop->m_Offset + add );
            } else if ( !isdigit( prop->m_pVarName[ 0 ] ) && prop->m_RecvType != DPT_Array && prop->m_RecvType != DPT_DataTable && prop->m_RecvType != DPT_String
                        && uint32_t( prop->m_Offset + extra ) > 0x40 ) {
               netvars.push_back( { prop->m_RecvType, prop->m_Offset + extra, prop->m_pVarName } );
            }
         }

         return extra;
      };

      //cs_player: 050
      if ( netvars.empty( ) ) {
         //add_all_netvars( cs_player );
         //add_all_netvars( DT_BaseCombatCharacter );
         add_all_netvars( DT_BaseFlex );
         //add_all_netvars( DT_BaseCombatCharacter );
      }

      Vector2D draw_pos = Vector2D( 200.0f, 10.0f );
      float biggestWidth = 0.0f;

      Render::Get( )->SetTextFont( FONT_VISITOR );

      for ( auto& net : netvars ) {
         static const auto MAX_BUFFER_SIZE = 4096;
         static char buffer[ MAX_BUFFER_SIZE ] = u8"";

         int kek = *( int* ) ( uintptr_t( player ) + net.offset );
         float kek2 = *( float* ) ( uintptr_t( player ) + net.offset );
         Vector kek3 = *( Vector* ) ( uintptr_t( player ) + net.offset );
         Vector2D kek4 = *( Vector2D* ) ( uintptr_t( player ) + net.offset );

         switch (net.m_RecvType) {
            case DPT_Int:
            // m_b
            if ( net.name[ 2 ] == XorStr( 'b' ) )
               sprintf_s( buffer, XorStr( "%s : %s [%X]" ), net.name, ( *( bool* ) ( uintptr_t( player ) + net.offset ) ) ? XorStr( "true" ) : XorStr( "false"), net.offset);
            else
               sprintf_s( buffer, XorStr( "%s : %d [%X]" ), net.name, kek, net.offset );
            break;
            case DPT_Float:
            sprintf_s( buffer, XorStr( "%s : %.5f [%X]" ), net.name, kek2, net.offset );
            break;
            case DPT_Vector:
            sprintf_s( buffer, XorStr( "%s : x %.5f y %.5f z %.5f [%X]" ), net.name, kek3.x, kek3.y, kek3.z, net.offset );
            break;
            case DPT_VectorXY:
            sprintf_s( buffer, XorStr( "%s : x %.5f y %.5f [%X]" ), net.name, kek4.x, kek4.y, net.offset );
            break;
            default:
            continue;
}

         Render::Get( )->AddText( draw_pos, 0xFFFFFFFF, OUTLINED, buffer );
         Vector2D size = Render::Get( )->CalcTextSize( buffer );
         biggestWidth = std::fmaxf( size.x, biggestWidth );

         draw_pos.y += size.y + 1.0f;
         if (draw_pos.y >= 1050.0f) {
            draw_pos.y = 10.0f;
            draw_pos.x += biggestWidth + 5.0f;
            biggestWidth = 0.0f;
         }
      }
   }
}
1703408643683.png
вопрос. Для чего?
 
Сверху Снизу