Guest User

AssaultCube Aimbot

a guest
Nov 3rd, 2009
954
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.29 KB | None | 0 0
  1. #define AIMLOCK 4.2f
  2. #define AIMSPEEDFACTOR 60
  3. #define AIMRANGE 180.0f
  4.  
  5. void getyawpitch(const vec &from, const vec &to, float &yaw, float &pitch){
  6.     float dist = from.dist(to);
  7.     yaw = -(float)atan2(to.x-from.x, to.y-from.y)/PI*180+180;
  8.     pitch = asin((to.z-from.z)/dist)/RAD;
  9. }
  10.  
  11. float absf(float f){
  12.     if(f<0.0f){
  13.         return -f;
  14.     }else{
  15.         return f;
  16.     }
  17. }
  18.  
  19. if(keys[VK_LSHIFT] && player1->state == CS_ALIVE){
  20.     float tDist = 99999.0f;
  21.     int tTarg = -1;
  22.     float ny, np;
  23.     float angleDist = 99999.0f;
  24.     loopv(players){ // Closest to Crosshair Aimbot
  25.         if(players[i] != NULL && player1 != NULL){
  26.             if(!isteam(player1->team,players[i]->team) && players[i]->state == CS_ALIVE){
  27.                 getyawpitch(player1->o,players[i]->o,ny,np);
  28.                 if((absf(player1->pitch - np) + absf(player1->yaw - ny)) < angleDist){
  29.                     angleDist = (absf(player1->pitch - np) + absf(player1->yaw - ny));
  30.                     tTarg = i;
  31.                 }
  32.             }
  33.         }
  34.     }
  35.     if(tTarg > -1){
  36.         if(players[tTarg] != NULL){
  37.             getyawpitch(player1->o,players[tTarg]->o,ny,np);
  38.             if(absf(player1->pitch-np)<AIMRANGE && absf(player1->yaw-ny)<AIMRANGE){
  39.                 if(player1->pitch > np){
  40.                     player1->pitch -= ((player1->pitch-np)/AIMSPEEDFACTOR);
  41.                     if((player1->pitch - np) < AIMLOCK){
  42.                         player1->pitch = np;
  43.                     }
  44.                 }
  45.                 if(player1->pitch < np){
  46.                     player1->pitch += ((np-player1->pitch)/AIMSPEEDFACTOR);
  47.                     if((np - player1->pitch) < AIMLOCK){
  48.                         player1->pitch = np;
  49.                     }
  50.                 }
  51.                 if(player1->yaw > ny){
  52.                     player1->yaw -= ((player1->yaw-ny)/AIMSPEEDFACTOR);
  53.                     if((player1->yaw - ny) < AIMLOCK){
  54.                         player1->yaw = ny;
  55.                     }
  56.                 }
  57.                 if(player1->yaw < ny){
  58.                     player1->yaw += ((ny-player1->yaw)/AIMSPEEDFACTOR);
  59.                     if((ny - player1->yaw) < AIMLOCK){
  60.                         player1->yaw = ny;
  61.                     }
  62.                 }
  63.             }
  64.         }
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment