diff --git a/uran/src/hacks/HAimbot.cpp b/uran/src/hacks/HAimbot.cpp index 1bc65267..d5211a85 100644 --- a/uran/src/hacks/HAimbot.cpp +++ b/uran/src/hacks/HAimbot.cpp @@ -50,6 +50,7 @@ void HAimbot::Create() { this->v_bProjectileAimbot = CreateConVar("u_aimbot_projectile", "1", "Projectile aimbot (EXPERIMENTAL)"); this->v_iOverrideProjSpeed = CreateConVar("u_aimbot_proj_speed", "0", "Override proj speed"); this->v_bDebug = CreateConVar("u_aimbot_debug", "0", "Aimbot debug"); + this->v_iFOV = CreateConVar("u_aimbot_fov", "0", "FOV aimbot (experimental)"); fix_silent = false; } @@ -146,11 +147,16 @@ bool HAimbot::ShouldTarget(IClientEntity* entity) { } int econd = GetEntityValue(entity, eoffsets.iCond1); if ((econd & cond_ex::vacc_bullet)) return false; - if (!m_bProjectileMode) + if (!m_bProjectileMode) { + Vector hbv; + if (GetHitboxPosition(entity, v_iHitbox->GetInt(), hbv)) return false; + if (v_iFOV->GetBool() && (GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye, hbv) > v_iFOV->GetInt())) return false; return IsEntityVisible(entity, v_iHitbox->GetInt()); - else { + } else { Vector res = entity->GetAbsOrigin(); - return PredictProjectileAim(g_pLocalPlayer->v_Eye, entity, (hitbox)v_iHitbox->GetInt(), m_flProjSpeed, m_bProjArc, res); + bool succ = PredictProjectileAim(g_pLocalPlayer->v_Eye, entity, (hitbox)v_iHitbox->GetInt(), m_flProjSpeed, m_bProjArc, res); + if (v_iFOV->GetBool() && (GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye, res) > v_iFOV->GetInt())) return false; + return succ; } } diff --git a/uran/src/hacks/HAimbot.h b/uran/src/hacks/HAimbot.h index f80d0135..7f0fe223 100644 --- a/uran/src/hacks/HAimbot.h +++ b/uran/src/hacks/HAimbot.h @@ -26,6 +26,7 @@ public: bool m_bProjArc; ConVar* v_bDebug; ConVar* v_bEnabled; + ConVar* v_iFOV; ConVar* v_iHitbox; ConVar* v_bPrediction; ConVar* v_bAutoShoot; diff --git a/uran/src/hacks/HEsp.cpp b/uran/src/hacks/HEsp.cpp index 335dec34..b574cef8 100644 --- a/uran/src/hacks/HEsp.cpp +++ b/uran/src/hacks/HEsp.cpp @@ -111,17 +111,22 @@ void HEsp::ProcessEntityPT(CachedEntity* ent) { Color color; switch (ent->m_iClassID) { case ClassID::CTFPlayer: { - if (v_bLegit->GetBool() && ent->m_iTeam != g_pLocalPlayer->team && !IsFriend(ent->m_pEntity)) { + if (v_bLegit->GetBool() && ent->m_iTeam != g_pLocalPlayer->team && !GetRelation(ent->m_pEntity)) { if (ent->Var(eoffsets.iCond) & cond::cloaked) return; if (ent->m_lLastSeen > v_iLegitSeenTicks->GetInt()) { return; } } - if (ent->Var(eoffsets.iTeamNum) == g_pLocalPlayer->team && !v_bTeammates->GetBool() && !(v_bShowFriends->GetBool() && IsFriend(ent->m_pEntity))) break; + if (ent->Var(eoffsets.iTeamNum) == g_pLocalPlayer->team && !v_bTeammates->GetBool() && !GetRelation(ent->m_pEntity)) break; if (!ent->m_bAlivePlayer) break; color = colors::GetTeamColor(ent->m_iTeam, !ent->m_bIsVisible); - if (v_bShowFriends->GetBool() && IsFriend(ent->m_pEntity)) { + switch (GetRelation(ent->m_pEntity)) { + case relation::FRIEND: + color = colors::green; + break; + case relation::RAGE: color = colors::yellow; + break; } DrawBox(ent, color, 3.0f, -15.0f, true, ent->Var(eoffsets.iHealth), ClassMaxHealth(ent->Var(eoffsets.iClass))); break; @@ -206,10 +211,18 @@ void HEsp::ProcessEntity(CachedEntity* ent) { // If target is enemy, always show powerups, if player is teammate, show powerups // only if bTeammatePowerup or bTeammates is true color = colors::GetTeamColor(ent->m_iTeam, !ent->m_bIsVisible); - if (v_bShowFriends->GetBool() && IsFriend(ent->m_pEntity)) { + switch (GetRelation(ent->m_pEntity)) { + case relation::FRIEND: + color = colors::green; + break; + case relation::RAGE: color = colors::yellow; + break; } - if (v_bLegit->GetBool() && ent->m_iTeam != g_pLocalPlayer->team && !IsFriend(ent->m_pEntity) && !IsRage(ent->m_pEntity)) { + + // TODO TEMP + //ent->AddESPString(color, "FOV %f", GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye, ent->m_pEntity->GetAbsOrigin())); + if (v_bLegit->GetBool() && ent->m_iTeam != g_pLocalPlayer->team && !GetRelation(ent->m_pEntity)) { if (pcond & cond::cloaked) return; if (ent->m_lLastSeen > v_iLegitSeenTicks->GetInt()) { return; @@ -218,7 +231,7 @@ void HEsp::ProcessEntity(CachedEntity* ent) { if (power >= 0 && (ent->m_bEnemy || this->v_bTeammatePowerup->GetBool() || this->v_bTeammates->GetBool())) { ent->AddESPString(color, "HAS [%s]", powerups[power]); } - if (ent->m_bEnemy || v_bTeammates->GetBool() || (v_bShowFriends->GetBool() && IsFriend(ent->m_pEntity))) { + if (ent->m_bEnemy || v_bTeammates->GetBool() || GetRelation(ent->m_pEntity)) { ent->AddESPString(color, "%s", info.name); if (v_bShowFriendID->GetBool()) { ent->AddESPString(color, "%lu", info.friendsID); diff --git a/uran/src/helpers.cpp b/uran/src/helpers.cpp index c392b1ee..952519d1 100644 --- a/uran/src/helpers.cpp +++ b/uran/src/helpers.cpp @@ -471,6 +471,43 @@ bool CheckCE(CachedEntity* entity) { return (entity && entity->m_pEntity && !entity->m_pEntity->IsDormant()); } +// F1 c&p +Vector CalcAngle(Vector src, Vector dst) { + Vector AimAngles; + Vector delta = src - dst; + float hyp = sqrtf((delta.x * delta.x) + (delta.y * delta.y)); //SUPER SECRET IMPROVEMENT CODE NAME DONUT STEEL + AimAngles.x = atanf(delta.z / hyp) * RADPI; + AimAngles.y = atanf(delta.y / delta.x) * RADPI; + AimAngles.z = 0.0f; + if(delta.x >= 0.0) + AimAngles.y += 180.0f; + return AimAngles; +} + +void MakeVector(Vector angle, Vector& vector) +{ + float pitch = float(angle[0] * PI / 180); + float yaw = float(angle[1] * PI / 180); + float tmp = float(cos(pitch)); + vector[0] = float(-tmp * -cos(yaw)); + vector[1] = float(sin(yaw)*tmp); + vector[2] = float(-sin(pitch)); +} + +float GetFov(Vector angle, Vector src, Vector dst) +{ + Vector ang, aim; + ang = CalcAngle(src, dst); + + MakeVector(angle, aim); + MakeVector(ang, ang); + + float mag = sqrtf(pow(aim.x, 2) + pow(aim.y, 2) + pow(aim.z, 2)); + float u_dot_v = aim.Dot(ang); + + return RAD2DEG(acos(u_dot_v / (pow(mag, 2)))); +} + const char* powerups[] = { "STRENGTH", "RESISTANCE", diff --git a/uran/src/helpers.h b/uran/src/helpers.h index f466504f..4663c7c5 100644 --- a/uran/src/helpers.h +++ b/uran/src/helpers.h @@ -16,6 +16,7 @@ class CUserCmd; class Vector; #define PI 3.14159265358979323846f +#define RADPI 57.295779513082f #define DEG2RAD(x) x * (PI / 180.0f) #include "enums.h" @@ -46,11 +47,13 @@ float deg2rad(float deg); bool GetProjectileData(IClientEntity* weapon, float& speed, bool& arc); bool IsVectorVisible(Vector a, Vector b); bool PredictProjectileAim(Vector origin, IClientEntity* target, hitbox hb, float speed, bool arc, Vector& result); -bool IsFriend(IClientEntity* ent); -bool IsRage(IClientEntity* ent); relation GetRelation(IClientEntity* ent); int ClassMaxHealth(int clazz); bool CheckCE(CachedEntity* entity); +// F1 c&p +Vector CalcAngle(Vector src, Vector dst); +void MakeVector(Vector ang, Vector& out); +float GetFov(Vector ang, Vector src, Vector dst); extern const char* powerups[POWERUP_COUNT]; extern const char* packs[PACK_COUNT];