Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (pCmd->buttons & IN_ATTACK)
- {
- float radius = 512.0f;
- C_BasePlayer *lp = UTIL_PlayerByIndex(1);
- C_BaseEntity *ents[256];
- int ent_count = UTIL_EntitiesInSphere(ents, 256, lp->GetAbsOrigin(), radius, 0);
- int i = 0;
- for (i = 0; i < ent_count; i++)
- {
- if (ents[i] == NULL) continue;
- if (!ents[i]->IsAlive()) continue;
- if (!ents[i]->IsNPC()) continue;
- if (!ents[i]->IsVisible()) continue;
- if (ents[i]->IsDormant()) continue;
- if (ents[i]->GetMoveType() == MOVETYPE_NONE) continue;
- if (ents[i]->GetMoveType() == MOVETYPE_OBSERVER) continue;
- Vector aimpos; aimpos.Init();
- aimpos = ents[i]->GetAbsOrigin();
- QAngle attchangles;
- int attch = ents[i]->LookupAttachment("ValveBiped.Bip01_Head1");
- if (attch > 0) ents[i]->GetAttachment(attch, aimpos, attchangles);
- QAngle aimang; aimang.Init();
- aimpos = aimpos - EyePosition();
- AngleVectors(aimang, &aimpos);
- pCmd->viewangles = aimang;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement