Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool CAimbot::EntityHit(int random_seed, CUserCmd* pCmd) {
- Vector3 viewangles = pCmd->viewangles;
- viewangles += HL2::m_pLocalEntity->GetPunchAngle() * 2.0f;
- Vector3 vSpread;
- gAccuracy.GetSpreadFix(random_seed, pCmd, vSpread);
- viewangles -= vSpread;
- int iEntityListSize = HL2::m_pEngine->GetMaxClients();
- for (int i = 1; i <= iEntityListSize; i++) {
- CBaseEntity* pEntity = HL2::m_pEntList->GetClientEntity(i);
- if (!pEntity) {
- continue;
- }
- if (pEntity->GetIndex() == HL2::m_pLocalEntity->GetIndex()) {
- continue;
- }
- if (pEntity->IsDormant()) {
- continue;
- }
- if (pEntity->IsDead()) {
- continue;
- }
- Vector3 vHead = pEntity->GetHitboxPosition(12);
- if (vHead.IsZero()) {
- continue;
- }
- if (!HL2::Visible(vHead, pEntity)) {
- continue;
- }
- Vector3 vStart = HL2::m_pLocalEntity->GetEyePosition();
- float fDistance = vStart.DistTo(vHead);
- Vector3 vEnd;
- AngleVector(viewangles, vEnd);
- vEnd = vEnd * fDistance + vStart;
- Vector3 vMin, vMax;
- pEntity->GetHitboxBound(12, vMin, vMax);
- if ((min(vMax.x, vMin.x) <= vEnd.x) &&
- (min(vMax.y, vMin.y) <= vEnd.y) &&
- (min(vMax.z, vMin.z) <= vEnd.z) &&
- (max(vMax.x, vMin.x) >= vEnd.x) &&
- (max(vMax.y, vMin.y) >= vEnd.y) &&
- (max(vMax.z, vMin.z) >= vEnd.z)) {
- return true;
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement