Advertisement
Guest User

Untitled

a guest
Feb 13th, 2015
1,233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //AIM
  2. bool smooth = false;
  3. IClientEntity* PlayerToAim;
  4. float AimFOV;
  5. bool isaimbotting;
  6.  
  7. //Hard Coded Made when TroubleShooting.
  8. int ScreenCenterX = 640;
  9. int ScreenCenterY = 480;
  10.  
  11. void AimAtPos(float x, float y)
  12. {
  13.  
  14.     //int width = GetSystemMetrics(SM_CXSCREEN);
  15.     //int height = GetSystemMetrics(SM_CYSCREEN);
  16.     //int ScreenCenterY = height * 0.5f;
  17.     //int ScreenCenterX = width * 0.5f;
  18.  
  19.     float AimSpeed = 5;
  20.     float TargetX = 0;
  21.     float TargetY = 0;
  22.  
  23.     //X Axis
  24.     if (x != 0)
  25.     {
  26.         if (x > ScreenCenterX)
  27.         {
  28.             TargetX = -(ScreenCenterX - x);
  29.             TargetX /= AimSpeed;
  30.             if (TargetX + ScreenCenterX > ScreenCenterX * 2) TargetX = 0;
  31.         }
  32.  
  33.         if (x < ScreenCenterX)
  34.         {
  35.             TargetX = x - ScreenCenterX;
  36.             TargetX /= AimSpeed;
  37.             if (TargetX + ScreenCenterX < 0) TargetX = 0;
  38.         }
  39.     }
  40.  
  41.     //Y Axis
  42.  
  43.     if (y != 0)
  44.     {
  45.         if (y > ScreenCenterY)
  46.         {
  47.             TargetY = -(ScreenCenterY - y);
  48.             TargetY /= AimSpeed;
  49.             if (TargetY + ScreenCenterY > ScreenCenterY * 2) TargetY = 0;
  50.         }
  51.  
  52.         if (y < ScreenCenterY)
  53.         {
  54.             TargetY = y - ScreenCenterY;
  55.             TargetY /= AimSpeed;
  56.             if (TargetY + ScreenCenterY < 0) TargetY = 0;
  57.         }
  58.     }
  59.  
  60.     if (!smooth)
  61.     {
  62.         mouse_event(MOUSEEVENTF_MOVE, (DWORD)(TargetX), (DWORD)(TargetY), NULL, NULL);
  63.         return;
  64.     }
  65.  
  66.     TargetX /= 10;
  67.     TargetY /= 10;
  68.  
  69.     //Mouse even't will round to 0 a lot of the time, so we can add this, to make it more accurrate on slow speeds.
  70.     if (fabs(TargetX) < 1)
  71.     {
  72.         if (TargetX > 0)
  73.         {
  74.             TargetX = 1;
  75.         }
  76.         if (TargetX < 0)
  77.         {
  78.             TargetX = -1;
  79.         }
  80.     }
  81.     if (fabs(TargetY) < 1)
  82.     {
  83.         if (TargetY > 0)
  84.         {
  85.             TargetY = 1;
  86.         }
  87.         if (TargetY < 0)
  88.         {
  89.             TargetY = -1;
  90.         }
  91.     }
  92.     mouse_event(MOUSEEVENTF_MOVE, TargetX, TargetY, NULL, NULL);
  93. }
  94.  
  95. float DistanceBetweenCross(float X, float Y)
  96. {
  97.     float ydist = (Y - ScreenCenterY/*GetSystemMetrics(SM_CYSCREEN)/2*/);
  98.     float xdist = (X - ScreenCenterX/*GetSystemMetrics(SM_CXSCREEN)/2*/);
  99.     float Hypotenuse = sqrt(pow(ydist, 2) + pow(xdist, 2));
  100.     return Hypotenuse;
  101. }
  102.  
  103. bool GetAimKey()
  104. {
  105.     return (GetAsyncKeyState(VK_LBUTTON));
  106. }
  107.  
  108. void GetClosestPlayerToCrossHair(IClientEntity* Player, float &max, float &aimfov)
  109. {
  110.     if (!GetAimKey() || !isaimbotting)
  111.     {
  112.         if (Player)
  113.         {
  114.             Vector Head;
  115.             Vector w2sHead;
  116.             //Head = cEng.GetEyePosition(Player);
  117.             if (cEng.GetBonePosition(Player, Head, 10))
  118.             {
  119.                 cMath.WorldToScreen(Head, w2sHead);
  120.                 float Dist = DistanceBetweenCross(w2sHead.X, w2sHead.Y);
  121.                 if (Dist < max)
  122.                 {
  123.                     max = Dist;
  124.                     PlayerToAim = Player;
  125.                     AimFOV = aimfov;
  126.                 }
  127.             }
  128.         }
  129.     }
  130.  
  131. }
  132.  
  133. void AimAt(IClientEntity* plr)
  134. {
  135.     if (plr)
  136.     {
  137.         if (!cEng.IsAlive(plr))
  138.         {
  139.             isaimbotting = false;
  140.             return;
  141.         }
  142.         Vector Head;
  143.         Vector w2sHead;
  144.         //Head = cEng.GetEyePosition(plr);
  145.         if (cEng.GetBonePosition(plr, Head, 10))
  146.         {
  147.             cMath.WorldToScreen(Head, w2sHead);
  148.             if (w2sHead.Y != 0 || w2sHead.X != 0)
  149.             {
  150.                 if ((DistanceBetweenCross(w2sHead.X, w2sHead.Y) <= AimFOV * 8) || isaimbotting)
  151.                 {
  152.                     isaimbotting = true;
  153.                     AimAtPos(w2sHead.X, w2sHead.Y);
  154.                 }
  155.             }
  156.         }
  157.     }
  158. }
  159.  
  160. void Aimbot()
  161. {
  162.     static bool aimbotON = false;
  163.     //Lazy!!!!, Make a fucking menu!
  164.     if (GetAsyncKeyState(VK_DELETE) & 1){ aimbotON = !aimbotON; }
  165.     if (GetAsyncKeyState(VK_INSERT) & 1){ smooth = !smooth; }
  166.     char msg[1024];
  167.     sprintf(msg, "[COUNTERNOOB v1.0] AIM: %s - Status: %s", aimbotON ? "ON!" : "OFF", smooth ? "Smooth" : "Precise");
  168.     cDraw.DrawString(espfont, 0, 10, 5, Color(255, 255, 255, 255), msg);
  169.     if (aimbotON)
  170.     {
  171.         if ((PlayerToAim != 0))
  172.         {
  173.             if (GetAimKey())
  174.             {
  175.                 AimAt(PlayerToAim);
  176.             }
  177.             else
  178.             {
  179.                 isaimbotting = false;
  180.             }
  181.         }
  182.     }
  183. }
  184.  
  185. void GetClosestPlayerToCrossHair(IClientEntity* Player, float max, float aimfov)
  186. {
  187.     if (!GetAimKey() || !isaimbotting)
  188.     {
  189.         if (Player)
  190.         {
  191.             Vector Head;
  192.             Vector w2sHead;
  193.             //Head = cEng.GetEyePosition(Player);
  194.             if (cEng.GetBonePosition(Player, Head, 10))
  195.             {
  196.                 if (Player != NULL) {
  197.                     if (cEng.IsAlive(Player)) {
  198.                         cMath.WorldToScreen(Head, w2sHead);
  199.                         float Dist = DistanceBetweenCross(w2sHead.X, w2sHead.Y);
  200.                         if (Dist < max)
  201.                         {
  202.                             max = Dist;
  203.                             PlayerToAim = Player;
  204.                             AimFOV = aimfov;
  205.  
  206.                         }
  207.                     }
  208.                 }
  209.             }
  210.         }
  211.     }
  212. }
  213.  
  214.  
  215. void iWannaCheat( )
  216. {
  217.     IClientEntity* pLocalEntity = pClientEntList->GetClientEntity(pEngine->GetLocalPlayer());
  218.     if(!pLocalEntity)
  219.         return;
  220.  
  221.     player_info_t pi;
  222.     float max = 400000.0f;
  223.  
  224.     static int iLocked = -1;
  225.     if ( cEng.IsAlive( pLocalEntity ) )
  226.     {
  227.         vEyePos = cEng.GetEyePosition( pLocalEntity );
  228.  
  229.         for( INT i = 0; i <= pClientEntList->GetHighestEntityIndex( ); i++ )
  230.         {
  231.             IClientEntity* pEntity = pClientEntList->GetClientEntity( i );
  232.  
  233.             if ((pEntity->GetTeamNum() != pLocalEntity->GetTeamNum()) && (pEngine->GetPlayerInfo(i, &pi)))
  234.             {
  235.                 GetClosestPlayerToCrossHair(pEntity, max, 40);
  236.             }
  237.  
  238.             if ( pEntity == NULL )
  239.                 continue;
  240.  
  241.             if ( pEntity->IsDormant( ) )
  242.                 continue;
  243.  
  244.             if ( !cEng.IsAlive( pEntity ) )
  245.                 continue;
  246.  
  247.             if ( pEntity->Index() == pLocalEntity->Index() )
  248.                 continue;
  249.  
  250.             cEsp.DrawPlayers(i, pLocalEntity, pEntity );
  251.         }
  252.     }
  253. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement