Advertisement
encoree1996

Untitled

Jun 21st, 2015
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.93 KB | None | 0 0
  1. QAngle angle;
  2. QAngle m_ViewAngle;
  3. QAngle OldAngle;
  4. float smooth = 2;
  5.  
  6. DWORD lastClick = 0;
  7.  
  8. void __fastcall hkPaintTraverse ( void* ecx, void* edx, unsigned int vguiPanel, bool forceRepaint, bool allowForce )
  9. {
  10. oPaintTraverse ( ecx, vguiPanel, forceRepaint, allowForce );
  11.  
  12. static DWORD lastShoot = 0;
  13.  
  14. if ( engine->IsInGame ( ) && engine->IsConnected ( ) && !engine->IsTakingScreenshot ( ) )
  15. {
  16.  
  17. if ( GetAsyncKeyState ( 6 ) )
  18. {
  19. if ( triggerBot ( ) )
  20. {
  21. DWORD currentCount = GetTickCount ( );
  22. if ( currentCount - lastShoot > 20 )
  23. {
  24. LeftClick ( );
  25. lastShoot = currentCount;
  26. }
  27. }
  28. }
  29.  
  30. C_BaseEntity *pLocalEntity = ( C_BaseEntity* )entitylist->GetClientEntity ( engine->GetLocalPlayer ( ) );
  31. if ( !pLocalEntity )
  32. return;
  33.  
  34. for ( int i = 0; i < entitylist->GetHighestEntityIndex ( ); i++ ) //spotter
  35. {
  36. C_BaseEntity* pBaseEntity = ( C_BaseEntity* )entitylist->GetClientEntity ( i );
  37. if ( !pBaseEntity )
  38. continue;
  39. if ( pBaseEntity->health ( ) < 1 )
  40. continue;
  41. if ( pBaseEntity == pLocalEntity )
  42. continue;
  43. if ( pLocalEntity->team ( ) == pBaseEntity->team ( ) )
  44. continue;
  45.  
  46. *( BYTE* )( ( DWORD )pBaseEntity + spotOffset ) = 1;
  47. }
  48.  
  49. if ( GetAsyncKeyState ( VK_INSERT ) )
  50. {
  51. DWORD tick = GetTickCount ( );
  52. if ( tick - lastClick > 100 )
  53. {
  54. smooth += 1;
  55. g_pCVar->ConsoleColorPrintf ( Color::Red ( ), "Current smooth: %f\n", smooth );
  56. lastClick = tick;
  57. }
  58. }
  59.  
  60. if ( GetAsyncKeyState ( VK_DELETE ) )
  61. {
  62. DWORD tick = GetTickCount ( );
  63. if ( tick - lastClick > 100 )
  64. {
  65. smooth -= 1;
  66. g_pCVar->ConsoleColorPrintf ( Color::Red ( ), "Current smooth: %f\n", smooth );
  67. lastClick = tick;
  68. }
  69. }
  70.  
  71.  
  72. if ( GetAsyncKeyState ( VK_LBUTTON ) )
  73. {
  74. if ( *( DWORD* )( ( DWORD )pLocalEntity + shotsFiredOffset ) > 1 )
  75. {
  76. if ( smooth < 1 )
  77. smooth = 1;
  78. if ( smooth > 99 )
  79. smooth = 99;
  80. QAngle tmp;
  81. engine->GetViewAngles ( tmp );
  82. m_ViewAngle = tmp;
  83.  
  84. QAngle* m_PunchAngle = pLocalEntity->GetAimPunchPtr ( );
  85. if ( !m_PunchAngle )
  86. return;
  87.  
  88. //g_pCVar->ConsolePrintf ( "PunchAngles: %f %f\n", m_PunchAngle->x, m_PunchAngle->y );
  89.  
  90.  
  91. m_ViewAngle.x = m_ViewAngle.x + OldAngle.x;
  92. m_ViewAngle.y = m_ViewAngle.y + OldAngle.y;
  93. // Add the old "viewpunch" so we get the "center" of the screen again
  94.  
  95. angle.x = m_ViewAngle.x - m_PunchAngle->x * 2.0f;
  96. angle.y = m_ViewAngle.y - m_PunchAngle->y * 2.0f;
  97. // remove the new "viewpunch" from the viewangles
  98.  
  99. QAngle delta = tmp - angle;
  100.  
  101. angle = tmp - delta / ( 100.0f - smooth );
  102.  
  103. normalizeAngle ( angle );
  104.  
  105. //g_pCVar->ConsolePrintf ( "OriginalAngles: %f %f\nSetting angles to %f %f\n", m_ViewAngle.x, m_ViewAngle.y, angle.x, angle.y );
  106. engine->SetViewAngles ( angle );
  107.  
  108. OldAngle.x = m_PunchAngle->x * 2;
  109. OldAngle.y = m_PunchAngle->y * 2;
  110. // save the old angle
  111.  
  112.  
  113.  
  114. } else
  115. {
  116. OldAngle.x = 0;
  117. OldAngle.y = 0;
  118. }
  119. } else
  120. {
  121. OldAngle.x = 0;
  122. OldAngle.y = 0;
  123. }
  124. }
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement