Advertisement
llBeastModell

BO2 Off Host Aimbot

Jun 7th, 2016
1,128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.60 KB | None | 0 0
  1.  
  2. //Aimbot is fully INVISIBLE in killcams and spectators and on your screen.
  3.  
  4.  
  5. void GetRandomFloats(int seed, float* fl1, float* fl2)
  6. {
  7.     _asm push fl2
  8.     _asm push fl1
  9.     _asm push seed
  10.     _asm mov eax, 0x4a66e0
  11.     _asm call eax
  12.     _asm add esp, 0xc
  13. }
  14.  
  15. void GetWeaponSpread ( weapon_t* pWeapon, float* WeaponSpread )
  16. {
  17.     DWORD CalculateWeaponSpread = 0x416C70;
  18.  
  19.     float MaxSpread = 0.0f;
  20.     float BaseSpread = 0.0f;
  21.     float SpreadMultiplier = 0.0f;
  22.  
  23.     _asm    mov ecx, dword ptr ds: [ pWeapon ];
  24.     _asm    mov edx, 0x794474;  
  25.  
  26.     _asm    lea edi, dword ptr ds: [ BaseSpread ];
  27.     _asm    lea esi, dword ptr ds: [ MaxSpread ];
  28.  
  29.     _asm    call dword ptr ds: [ CalculateWeaponSpread ];
  30.  
  31.     _asm    fld dword ptr ds: [ 0x84CAA0 ];
  32.     _asm    fdiv qword ptr ds: [ 0x70AEE0 ];
  33.     _asm    fstp dword ptr ds: [ SpreadMultiplier ];
  34.    
  35.  
  36.     *WeaponSpread = BaseSpread + ( ( MaxSpread - BaseSpread ) * SpreadMultiplier );
  37. }
  38.  
  39. weapon_t* GetPlayerWeapon( int iIndex )
  40. {
  41.     return (( weapon_t** ) 0x736DB8 )[iIndex];
  42. }
  43.  
  44. VOID CorrectSpread( )
  45. {
  46.     if(cg->snap)
  47.     {
  48.        
  49.         input_t* input = (input_t*)0xcc4ff8;
  50.         usercmd_t * cmd = input->GetUserCmd( input->currentCmdNum - 1);
  51.         cmd->servertime        =  *(int*)0x794464 + 1;
  52.  
  53.         FirstBulletFix();//from king-orgy can be found on UC at cod4 section
  54.  
  55.         Vector3 ForwardVec, RightVec, UpVec, CalculatedSpreadView, SpreadView, DestinationVec;
  56.  
  57.         int seed     =  *(int*)0x794474;
  58.        
  59.         Vector3 vWeaponAngles;
  60.  
  61.         GetWeaponView( vWeaponAngles );
  62.        
  63.         CMath.NSAngleVectors( vWeaponAngles, ForwardVec, RightVec, UpVec );
  64.        
  65.         float flSpread;
  66.        
  67.         weapon_t * pWeapon = GetPlayerWeapon( cg_entities2[cg->clientNum].nWeaponID );
  68.        
  69.         GetWeaponSpread( pWeapon, &flSpread );
  70.  
  71.         flSpread *= 0.01745329238474369f;
  72.         flSpread = tan(flSpread) * 8192.0f;
  73.  
  74.         float flSpreadRight, flSpreadUp;
  75.  
  76.         Vector3 myViewpoint = {0, 0, 0 };
  77.         GetViewPoint ( myViewpoint );
  78.  
  79.         GetRandomFloats( seed,  &flSpreadRight, &flSpreadUp );
  80.         flSpreadRight *= flSpread;
  81.         flSpreadUp    *= flSpread;
  82.  
  83.         SpreadView[ 0 ] = myViewpoint[ 0 ] + ForwardVec[ 0 ] * 8192 + RightVec[ 0 ] * flSpreadRight + UpVec[ 0 ] * flSpreadUp;
  84.         SpreadView[ 1 ] = myViewpoint[ 1 ] + ForwardVec[ 1 ] * 8192 + RightVec[ 1 ] * flSpreadRight + UpVec[ 1 ] * flSpreadUp;
  85.         SpreadView[ 2 ] = myViewpoint[ 2 ] + ForwardVec[ 2 ] * 8192 + RightVec[ 2 ] * flSpreadRight + UpVec[ 2 ] * flSpreadUp;
  86.  
  87.         CalculatedSpreadView[ 0 ] = SpreadView[ 0 ] - myViewpoint[ 0 ];
  88.         CalculatedSpreadView[ 1 ] = SpreadView[ 1 ] - myViewpoint[ 1 ];
  89.         CalculatedSpreadView[ 2 ] = SpreadView[ 2 ] - myViewpoint[ 2 ];
  90.  
  91.         CMath.NSVectorAngles( CalculatedSpreadView, DestinationVec );
  92.  
  93.         Vector3 FinalVecAngles;
  94.        
  95.         DestinationVec[ 0 ] *= -1;
  96.  
  97.         FinalVecAngles[ 0 ] = viewMatrix->viewAngles[ 0 ] - DestinationVec[ 0 ];
  98.         FinalVecAngles[ 1 ] = viewMatrix->viewAngles[ 1 ] - DestinationVec[ 1 ];
  99.         FinalVecAngles[ 2 ] = 0;
  100.        
  101.         if ( !clientInfo[cg->clientNum].zoomed )// WE NEED DO IT ONLY WHEN NOT ZOOMED
  102.         {
  103.             cmd->viewangles[ 0 ] += ANGLE2SHORT( FinalVecAngles[ 0 ] );
  104.             cmd->viewangles[ 1 ] += ANGLE2SHORT( FinalVecAngles[ 1 ] );
  105.             cmd->viewangles[ 2 ] += ANGLE2SHORT( FinalVecAngles[ 2 ] );
  106.         }
  107.  
  108.         //viewangles->ViewAngle[ 0 ] -= vFinalSpreadAngles[ 0 ];
  109.         //viewangles->ViewAngle[ 1 ] -= vFinalSpreadAngles[ 1 ];
  110.     }
  111. }
  112. call CorrectSpread(); in writepacket or cg_predictedplayerstate.
  113.  
  114.  
  115. void ( *orig_CG_PredictPlayerState )( int unk );
  116. void CG_PredictPlayerState_Hook( int unk )
  117. {
  118.     orig_CG_PredictPlayerState( unk );
  119.     clientInfo_t * pLocal = &clientInfo( cg->clientNum );
  120.     centity_t *pLocalEntity = &cg_entities[ cg->clientNum];
  121.     if( pLocalEntity != 0 && pLocalEntity->currentValid && ( ( pLocalEntity->eState.isAlive ) & 1 ) && pLocal != 0 )
  122.     {
  123.         CorrectSpread();
  124.     }
  125. }
  126.  
  127. DetourFunction( ( PBYTE )0x447260, ( PBYTE )&CG_PredictPlayerState );
  128. __asm mov [ orig_CG_PredictPlayerState ], eax;
  129. credits: crazyninja, x22, chod, crx, unreal
  130.  
  131. [Auto Merged - 11:51:57 UTC]
  132.  
  133. and to make full silent aim off it add this
  134.  
  135.  
  136. if(cvar.silentaim)
  137. {
  138.             cmd->viewangles[ 0 ] += ANGLE2SHORT( stealthAimAngles[ 0 ] );
  139.             cmd->viewangles[ 1 ] += ANGLE2SHORT( stealthAimAngles[ 1 ] );
  140.             cmd->viewangles[ 2 ] += ANGLE2SHORT( stealthAimAngles[ 2 ] );
  141. }
  142. below
  143.  
  144. cmd->viewangles[ 2 ] += ANGLE2SHORT( FinalVecAngles[ 2 ] );
  145.  
  146. float stealthAimAngles[3];
  147.  
  148. and in aimbot
  149.  
  150.  
  151. CMath.GetAngleToOrigin( vOrg, ViewAngle[ 0 ], ViewAngle[ 1 ] );
  152.         if ( cvar.silentaim )
  153.         {
  154.             stealthAimAngles[ 0 ] = ViewAngle[ 1 ];
  155.             stealthAimAngles[ 1 ] = ViewAngle[ 0 ];
  156.             stealthAimAngles[ 2 ] = 0;
  157.         }
  158.         else
  159.         {
  160.             /*D3DXVECTOR3 CalculatedPos;
  161.             CalculatedPos = *(D3DXVECTOR3*)&vOrg - *(D3DXVECTOR3*)&camera->Location;
  162.             D3DXVec3Normalize( &CalculatedPos, &CalculatedPos );
  163.            
  164.             viewangles->ViewAngle[ 1 ] += D3DXToDegree( asin( D3DXVec3Dot((D3DXVECTOR3*)&camera->ViewMatrix[ 1 ], &CalculatedPos )));
  165.             viewangles->ViewAngle[ 0 ] -= D3DXToDegree( asin( D3DXVec3Dot((D3DXVECTOR3*)&camera->ViewMatrix[ 2 ], &CalculatedPos )));*/
  166.  
  167.             viewangles->ViewAngle[ 1 ] += ViewAngle[ 0 ];
  168.             viewangles->ViewAngle[ 0 ] += ViewAngle[ 1 ];
  169.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement