Guest User

very private and very fast aiming module for garrys mod

a guest
Jan 9th, 2015
793
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1.  
  2.  
  3. if (pCmd->buttons & IN_ATTACK)
  4. {
  5.     float radius = 512.0f;
  6.     C_BasePlayer *lp = UTIL_PlayerByIndex(1);
  7.     C_BaseEntity *ents[256];
  8.     int ent_count = UTIL_EntitiesInSphere(ents, 256, lp->GetAbsOrigin(), radius, 0);
  9.     int i = 0;
  10.     for (i = 0; i < ent_count; i++)
  11.     {
  12.         if (ents[i] == NULL) continue;
  13.         if (!ents[i]->IsAlive()) continue;
  14.         if (!ents[i]->IsNPC()) continue;
  15.         if (!ents[i]->IsVisible()) continue;
  16.         if (ents[i]->IsDormant()) continue;
  17.         if (ents[i]->GetMoveType() == MOVETYPE_NONE) continue;
  18.         if (ents[i]->GetMoveType() == MOVETYPE_OBSERVER) continue;
  19.        
  20.         Vector aimpos; aimpos.Init();
  21.         aimpos = ents[i]->GetAbsOrigin();
  22.         QAngle attchangles;
  23.        
  24.         int attch = ents[i]->LookupAttachment("ValveBiped.Bip01_Head1");
  25.         if (attch > 0) ents[i]->GetAttachment(attch, aimpos, attchangles);
  26.        
  27.         QAngle aimang; aimang.Init();
  28.         aimpos = aimpos - EyePosition();
  29.         AngleVectors(aimang, &aimpos);
  30.        
  31.         pCmd->viewangles = aimang;
  32.     }
  33. }
  34.  
  35. &nbsp;
Advertisement
Add Comment
Please, Sign In to add comment