Advertisement
fqrmix

main.cpp

Jan 27th, 2017
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.53 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include "top.h"
  3.  
  4. /* sdk */
  5. #include "client-entity-list.h"
  6. #include "engine-client.h"
  7. #include "base-client.h"
  8. #include "clientmode.h"
  9. #include "usercmd.h"
  10. #include "panel.h"
  11. #include "surface.h"
  12. #include "hook.h"
  13.  
  14. CTools * Tools;
  15. IPanel * Panel;
  16. ISurface * Surface;
  17. IClientMode ** ClientMode;
  18. IVEngineClient * EngineClient;
  19. IBaseClientDll * BaseClientDll;
  20. IClientEntityList * ClientEntityList;
  21.  
  22. /* cheat */
  23. #include "esp.h"
  24.  
  25. CHook * PanelHook;
  26. CHook * CreateMoveHook;
  27.  
  28. CESP * ESP;
  29. CRender * Render;
  30.  
  31. PaintTraverse _PaintTraverse;
  32. CreateMove _CreateMove;
  33.  
  34. /* ptrav hook function */
  35. void SetupConsole()
  36. {
  37.     AllocConsole();
  38.     freopen("CONOUT$", "wb", stdout);
  39.     freopen("CONOUT$", "wb", stderr);
  40.     freopen("CONIN$", "rb", stdin);
  41.     SetConsoleTitle("Debug");
  42. }
  43. void __stdcall HookedPaintTraverse( int VGUIPanel, bool ForceRepaint, bool AllowForce )
  44. {
  45.     SetupConsole();
  46.     _PaintTraverse( Panel, VGUIPanel, ForceRepaint, AllowForce );
  47.  
  48.     /* right panel */
  49.     if ( !strcmp( "FocusOverlayPanel", Panel->GetName( VGUIPanel ) ) )
  50.     {
  51.         std::cout << Panel->GetName(VGUIPanel);
  52.         //if ( EngineClient->IsInGame( ) && EngineClient->IsConnected( ) )
  53.         //{
  54.             Render->DrawF( 10, 10, CColor( 26, 188, 156, 255 ), 5, 0, "[ pantsu-mephistopheles by madddie.co ]" );
  55.             std::cout << "Eto ne DrawF crash";
  56.             //ESP->Think( );
  57.         //}
  58.     }
  59. }
  60.  
  61. /* cmove hook function */
  62. bool __stdcall HookedCreateMove( float SampleTime, CUserCmd* UserCmd )
  63. {
  64.     SetupConsole();
  65.     if ( !UserCmd->CommandNumber )
  66.         return true;
  67.  
  68.     /* code goes here */
  69.  
  70.     if ( EngineClient->IsInGame( ) && EngineClient->IsConnected( ) )
  71.     {
  72.         CBaseEntity * Local = ( CBaseEntity* ) ClientEntityList->GetClientEntity( EngineClient->GetLocalPlayer( ) );
  73.         if ( !Local )
  74.             return true;
  75.  
  76.         /* example bhop */
  77.         /*if ( UserCmd->Buttons & IN_JUMP )
  78.         {
  79.             if ( !( Local->GetFlags( ) & FL_ONGROUND ) )
  80.             {
  81.                 UserCmd->Buttons &= ~IN_JUMP;
  82.             }
  83.         } */
  84.  
  85.         // not accurate and does not look legit, todo; save angles
  86.         // idk why -= operator doesnt work, someone fix plz
  87.         UserCmd->ViewAngles.x -= Local->GetPunch( ).x * 2.f;
  88.         UserCmd->ViewAngles.y -= Local->GetPunch( ).y * 2.f;
  89.  
  90.     }
  91.  
  92.     return false;
  93. }
  94. /* main */
  95. void __stdcall Start( )
  96. {
  97.     SetupConsole();
  98.     /* maketools */
  99.     Tools = new CTools;
  100.  
  101.     /* createinterface the objects we need */
  102.     Panel = ( IPanel* )Tools->GetInterface( "vgui2.dll", "VGUI_Panel009" );
  103.     Surface = ( ISurface* )Tools->GetInterface( "vguimatsurface.dll", "VGUI_Surface031" );
  104.     EngineClient = ( IVEngineClient* )Tools->GetInterface( "engine.dll", "VEngineClient014" );
  105.     ClientEntityList = ( IClientEntityList* )Tools->GetInterface( "client.dll", "VClientEntityList003" );
  106.     BaseClientDll = ( IBaseClientDll* ) Tools->GetInterface( "client.dll", "VClient016" );
  107.  
  108.  
  109.     /* get g_pClientMode */
  110.     void** BaseClientDllVMT = *( void*** ) BaseClientDll;
  111.     ClientMode = *( IClientMode*** ) ( ( DWORD ) BaseClientDllVMT[ 10 ] + 5 );
  112.  
  113.     /* init cheat */
  114.     ESP = new CESP;
  115.  
  116.     /* setup ptrav hook */
  117.     PanelHook = new CHook( ( DWORD** ) Panel );
  118.     _PaintTraverse = ( PaintTraverse ) PanelHook->dwHookMethod( ( DWORD ) HookedPaintTraverse, 41 );
  119.     /* setup cmove hook */
  120.     //CreateMoveHook = new CHook( *( DWORD*** ) ClientMode );
  121.     //_CreateMove = ( CreateMove ) CreateMoveHook->dwHookMethod( ( DWORD ) HookedCreateMove, 24 );
  122.  
  123.     return;
  124. }
  125.  
  126.  
  127. int __stdcall DllMain( HMODULE Instacen, DWORD Reason, LPVOID _Reserved )
  128. {
  129.     SetupConsole();
  130.     if ( Reason == 1 )
  131.     {
  132.         CreateThread( 0, 0, ( LPTHREAD_START_ROUTINE ) Start, 0, 0, 0 );
  133.     }
  134.  
  135.     return 1;
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement