Advertisement
captmicro

Untitled

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