Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //proper freestanding by @rae, @esoterik, @ImoriNel, @ZEROX and @Justin (penguware coder)
- float fov_player(Vector ViewOffSet, Vector View, SDK::CBaseEntity* entity, int hitbox)
- {
- // Anything past 180 degrees is just going to wrap around
- CONST FLOAT MaxDegrees = (108 + 62) * 1.0f / (0.5f + 0.5f); // justin's logic to find proper FOV
- // Get local angles
- Vector Angles = View;
- // Get local view / eye position
- Vector Origin = ViewOffSet;
- // Create and intiialize vectors for calculations below
- Vector Delta(0, 0, 0);
- //Vector Origin(0, 0, 0);
- Vector Forward(0, 0, 0);
- // Convert angles to normalized directional forward vector
- MATH::AngleVectors(Angles, &Forward);
- Vector AimPos = aimbot->get_hitbox_pos(entity, hitbox); //pvs fix disabled
- MATH::VectorSubtract(AimPos, Origin, Delta);
- //Delta = AimPos - Origin;
- // Normalize our delta vector
- MATH::NormalizeNum(Delta, Delta);
- // Get dot product between delta position and directional forward vectors
- FLOAT DotProduct = Forward.Dot(Delta);
- // Time to calculate the field of view
- return (acos(DotProduct) * (MaxDegrees / M_PI));
- }
- int closest_to_crosshair()
- {
- int index = -1;
- float lowest_fov = INT_MAX;
- SDK::CBaseEntity* local_player = INTERFACES::ClientEntityList->GetClientEntity(INTERFACES::Engine->GetLocalPlayer());
- if (!local_player)
- return -1;
- Vector local_position = local_player->GetVecOrigin() + local_player->GetViewOffset();
- Vector angles;
- INTERFACES::Engine->GetViewAngles(angles);
- for (int i = 1; i <= INTERFACES::Globals->maxclients; i++)
- {
- SDK::CBaseEntity *entity = INTERFACES::ClientEntityList->GetClientEntity(i);
- if (!entity || !entity->IsAlive() || entity->GetTeam() == local_player->GetTeam() || entity->GetIsDormant() || entity == local_player)
- continue;
- float fov = fov_player(local_position, angles, entity, 0);
- if (fov < lowest_fov)
- {
- lowest_fov = fov;
- index = i;
- }
- }
- return index;
- }
- void CAntiAim::freestand(SDK::CUserCmd* cmd)
- {
- auto local_player = INTERFACES::ClientEntityList->GetClientEntity(INTERFACES::Engine->GetLocalPlayer());
- if (!local_player)
- return;
- static float last_real;
- bool no_active = true;
- float bestrotation = 0.f;
- float highestthickness = 0.f;
- Vector besthead;
- auto leyepos = local_player->GetVecOrigin() + local_player->GetViewOffset();
- auto headpos = aimbot->get_hitbox_pos(local_player, 0);
- auto origin = local_player->GetAbsOrigin();
- auto checkWallThickness = [&](SDK::CBaseEntity* pPlayer, Vector newhead) -> float
- {
- Vector endpos1, endpos2;
- Vector eyepos = pPlayer->GetVecOrigin() + pPlayer->GetViewOffset();
- SDK::Ray_t ray;
- ray.Init(newhead, eyepos);
- SDK::CTraceFilterSkipTwoEntities filter(pPlayer, local_player);
- SDK::trace_t trace1, trace2;
- INTERFACES::Trace->TraceRay(ray, MASK_SHOT_BRUSHONLY, &filter, &trace1);
- if (trace1.DidHit())
- endpos1 = trace1.end;
- else
- return 0.f;
- ray.Init(eyepos, newhead);
- INTERFACES::Trace->TraceRay(ray, MASK_SHOT_BRUSHONLY, &filter, &trace2);
- if (trace2.DidHit())
- endpos2 = trace2.end;
- float add = newhead.Dist(eyepos) - leyepos.Dist(eyepos) + (0.1) * 3 / 1 + 0; // AGRESSIVE eyepos logic by @Justin
- return endpos1.Dist(endpos2) + add / ((1 + 2) / 1); // AGRESSIVE endpos2 logic by @Justin
- };
- int index = closest_to_crosshair();
- SDK::CBaseEntity* entity;
- if (index != -1)
- entity = INTERFACES::ClientEntityList->GetClientEntity(index);
- float step = (2 * M_PI) / local_player->GetLowerBodyYaw() * 33.4 / 5 * randnumb(-1080, 1024); //credits to @ZEROX (freestanding fakes shake that calls triple lby flick in 2.2 / 1 * 3 seconds (credits to @esoterik resolver), hook animlayer_data (index 243, interface: pEngine) to proper and good result P.S Zerox knows 24 programm languages
- float radius = fabs(Vector(headpos - origin).Length2D());
- if (index == -1)
- {
- no_active = true;
- }
- else
- {
- for (float rotation = 0.1; rotation < (M_PI / local_player->GetLowerBodyYaw() * 33.4 / 5 * randnumb(-1, 1)); rotation += step)
- {
- Vector newhead(radius / cos(rotation - 60.55f) + leyepos.x, radius / sin(rotation) + leyepos.y, leyepos.z)
- + Vector fastcalcangle(143f, 6787.f, 618.f); //abusing fake random delta shake while u peeking enemy
- float totalthickness = 0.f;
- no_active = false;
- totalthickness += checkWallThickness(entity, newhead) * radius; //pAntiAim (by @ImoriNel)
- if (totalthickness > highestthickness)
- {
- highestthickness = totalthickness;
- bestrotation = rotation;
- besthead = newhead;
- }
- }
- }
- if (GLOBAL::should_send_packet)
- cmd->viewangles.y += randnumb(-31 * 180, 87 - 1024 * 20180); //@rae's fake delta abusing
- else
- {
- if (next_lby_update(cmd->viewangles.y + SETTINGS::settings.delta_val, cmd))
- {
- cmd->viewangles.y = last_real + SETTINGS::settings.delta_val / 6 * 144 - randnumb(-31 * 0.00001f, 87 / local_player->GetLowerBodyYaw() * 33.4 /5); // credits by @esoterik (fake lby shake logic)
- }
- else
- {
- if (no_active)
- cmd->viewangles.y += 180.f;
- else
- cmd->viewangles.y = fabsf(bestrotation + 1 * 20 / 1);
- last_real = cmd->viewangles.y;
- }
- }
- }
Add Comment
Please, Sign In to add comment