diff --git a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp index 22f7ebc9..b0ebbf74 100644 --- a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp @@ -201,7 +201,7 @@ bool CAimbotGlobal::ShouldIgnore(CBaseEntity* pEntity, CTFPlayer* pLocal, CTFWea if (auto pGameRules = I::TFGameRules()) { - if (pGameRules->m_bTruceActive() && (FriendlyFire() || pLocal->m_iTeamNum() != pEntity->m_iTeamNum())) + if (pGameRules->m_bTruceActive() && (SDK::FriendlyFire() || pLocal->m_iTeamNum() != pEntity->m_iTeamNum())) return true; } @@ -213,7 +213,7 @@ bool CAimbotGlobal::ShouldIgnore(CBaseEntity* pEntity, CTFPlayer* pLocal, CTFWea if (pPlayer == pLocal || !pPlayer->IsAlive() || pPlayer->IsAGhost()) return true; - if (!FriendlyFire() && pLocal->m_iTeamNum() == pEntity->m_iTeamNum()) + if (!SDK::FriendlyFire() && pLocal->m_iTeamNum() == pEntity->m_iTeamNum()) return false; if (iFunctionFlags & ShouldIgnoreEnum::Ignored && F::PlayerUtils.IsIgnored(pPlayer->entindex()) @@ -339,12 +339,6 @@ int CAimbotGlobal::GetPriority(int iIndex) return F::PlayerUtils.GetPriority(iIndex); } -bool CAimbotGlobal::FriendlyFire() -{ - static auto mp_friendlyfire = H::ConVars.FindVar("mp_friendlyfire"); - return mp_friendlyfire->GetBool(); -} - bool CAimbotGlobal::ShouldAim() { switch (Vars::Aimbot::General::AimType.Value) @@ -387,7 +381,7 @@ bool CAimbotGlobal::ValidBomb(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CBaseEn sphere.NextEntity()) { if (pEntity == pLocal || pEntity->IsPlayer() && (!pEntity->As()->IsAlive() || pEntity->As()->IsAGhost()) - || !FriendlyFire() && pEntity->m_iTeamNum() == pLocal->m_iTeamNum()) + || !SDK::FriendlyFire() && pEntity->m_iTeamNum() == pLocal->m_iTeamNum()) continue; Vec3 vPos; pEntity->m_Collision()->CalcNearestPoint(vOrigin, &vPos); diff --git a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.h b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.h index b1f5c2cc..702c2665 100644 --- a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.h +++ b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.h @@ -43,7 +43,6 @@ public: bool ShouldIgnore(CBaseEntity* pTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon, int iFunctionFlags = ShouldIgnoreEnum::Dormant | ShouldIgnoreEnum::Ignored, int iTargetFlags = Vars::Aimbot::General::Target.Value, int iIgnoreFlags = Vars::Aimbot::General::Ignore.Value); int GetPriority(int iIndex); - bool FriendlyFire(); bool ShouldAim(); bool ShouldHoldAttack(CTFWeaponBase* pWeapon); diff --git a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp index 82b6635a..6ac71de5 100644 --- a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp @@ -19,9 +19,9 @@ static inline std::vector GetTargets(CTFPlayer* pLocal, CTFWeaponBase* auto eGroup = EntityEnum::Invalid; if (Vars::Aimbot::General::Target.Value & Vars::Aimbot::General::TargetEnum::Players) { - eGroup = !F::AimbotGlobal.FriendlyFire() || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Team ? EntityEnum::PlayerEnemy : EntityEnum::PlayerAll; + eGroup = !SDK::FriendlyFire() || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Team ? EntityEnum::PlayerEnemy : EntityEnum::PlayerAll; if (Vars::Aimbot::Hitscan::Modifiers.Value & Vars::Aimbot::Hitscan::ModifiersEnum::ExtinguishTeam && - !F::AimbotGlobal.FriendlyFire() && SDK::AttribHookValue(0, "jarate_duration", pWeapon) > 0) + !SDK::FriendlyFire() && SDK::AttribHookValue(0, "jarate_duration", pWeapon) > 0) eGroup = EntityEnum::PlayerAll; } if (pWeapon->GetWeaponID() == TF_WEAPON_MEDIGUN) @@ -43,7 +43,7 @@ static inline std::vector GetTargets(CTFPlayer* pLocal, CTFWeaponBase* && !H::Entities.IsFriend(pEntity->entindex()) && !H::Entities.InParty(pEntity->entindex())) continue; } - if (!F::AimbotGlobal.FriendlyFire() && SDK::AttribHookValue(0, "jarate_duration", pWeapon) > 0) + if (!SDK::FriendlyFire() && SDK::AttribHookValue(0, "jarate_duration", pWeapon) > 0) { if (!pEntity->As()->InCond(TF_COND_BURNING)) continue; diff --git a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp index 28eaa1bd..2c500ad7 100644 --- a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp @@ -31,9 +31,9 @@ static inline std::vector GetTargets(CTFPlayer* pLocal, CTFWeaponBase* if (Vars::Aimbot::General::Target.Value & Vars::Aimbot::General::TargetEnum::Players) { - auto eGroup = !F::AimbotGlobal.FriendlyFire() || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Team ? EntityEnum::PlayerEnemy : EntityEnum::PlayerAll; + auto eGroup = !SDK::FriendlyFire() || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Team ? EntityEnum::PlayerEnemy : EntityEnum::PlayerAll; if (Vars::Aimbot::Melee::WhipTeam.Value && - !F::AimbotGlobal.FriendlyFire() && SDK::AttribHookValue(0, "speed_buff_ally", pWeapon) > 0) + !SDK::FriendlyFire() && SDK::AttribHookValue(0, "speed_buff_ally", pWeapon) > 0) eGroup = EntityEnum::PlayerAll; for (auto pEntity : H::Entities.GetGroup(eGroup)) @@ -48,7 +48,7 @@ static inline std::vector GetTargets(CTFPlayer* pLocal, CTFWeaponBase* float flDistTo = vLocalPos.DistToSqr(vPos); bool bTeam = pEntity->m_iTeamNum() == pLocal->m_iTeamNum(); int iPriority = F::AimbotGlobal.GetPriority(pEntity->entindex()); - if (bTeam && !F::AimbotGlobal.FriendlyFire()) + if (bTeam && !SDK::FriendlyFire()) iPriority = 0; vTargets.emplace_back(pEntity, TargetEnum::Player, vPos, vAngleTo, flFOVTo, flDistTo, iPriority); } diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp index 0bd84f5b..ad352a81 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp @@ -31,7 +31,7 @@ static inline std::vector GetTargets(CTFPlayer* pLocal, CTFWeaponBase* { auto eGroup = EntityEnum::Invalid; if (Vars::Aimbot::General::Target.Value & Vars::Aimbot::General::TargetEnum::Players) - eGroup = !F::AimbotGlobal.FriendlyFire() || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Team ? EntityEnum::PlayerEnemy : EntityEnum::PlayerAll; + eGroup = !SDK::FriendlyFire() || Vars::Aimbot::General::Ignore.Value & Vars::Aimbot::General::IgnoreEnum::Team ? EntityEnum::PlayerEnemy : EntityEnum::PlayerAll; switch (pWeapon->GetWeaponID()) { case TF_WEAPON_CROSSBOW: @@ -1181,7 +1181,7 @@ bool CAimbotProjectile::TestAngle(const Vec3& vPoint, const Vec3& vAngles, int i filter.iPlayer = iType == PointTypeEnum::Direct ? PLAYER_DEFAULT : PLAYER_NONE; filter.bMisc = iType == PointTypeEnum::Direct; int nMask = MASK_SOLID; - if (iType == PointTypeEnum::Direct && F::AimbotGlobal.FriendlyFire()) + if (iType == PointTypeEnum::Direct && SDK::FriendlyFire()) { switch (pWeapon->GetWeaponID()) { // only weapons that actually hit teammates properly diff --git a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp index 56f0b042..ee103f38 100644 --- a/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp +++ b/Amalgam/src/Features/Aimbot/AutoDetonate/AutoDetonate.cpp @@ -114,7 +114,7 @@ bool CAutoDetonate::CheckEntities(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUs sphere.NextEntity()) { if (pEntity == pLocal || pEntity->IsPlayer() && (!pEntity->As()->IsAlive() || pEntity->As()->IsAGhost()) - || !F::AimbotGlobal.FriendlyFire() && pEntity->m_iTeamNum() == pLocal->m_iTeamNum() + || !SDK::FriendlyFire() && pEntity->m_iTeamNum() == pLocal->m_iTeamNum() || F::AimbotGlobal.ShouldIgnore(pEntity, pLocal, pWeapon)) continue; diff --git a/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.cpp b/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.cpp index e01e25e4..3672d935 100644 --- a/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.cpp +++ b/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.cpp @@ -477,7 +477,7 @@ void CAutoHeal::GetDangers(CTFPlayer* pTarget, bool bVaccinator, float& flBullet pOwner = pWeapon ? pWeapon->m_hOwner()->As() : nullptr; } if (!pOwner || ShouldIgnore(pOwner, m_pLocal, m_pWeapon) - || (!F::AimbotGlobal.FriendlyFire() || pEntity->GetClassID() == ETFClassID::CTFProjectile_HealingBolt) && pOwner->m_iTeamNum() == pTarget->m_iTeamNum() + || (!SDK::FriendlyFire() || pEntity->GetClassID() == ETFClassID::CTFProjectile_HealingBolt) && pOwner->m_iTeamNum() == pTarget->m_iTeamNum() || pWeapon && !pWeapon->GetDamage()) continue; diff --git a/Amalgam/src/Features/CritHack/CritHack.cpp b/Amalgam/src/Features/CritHack/CritHack.cpp index 8b557bd5..f5102f84 100644 --- a/Amalgam/src/Features/CritHack/CritHack.cpp +++ b/Amalgam/src/Features/CritHack/CritHack.cpp @@ -297,23 +297,24 @@ void CCritHack::Reset() -int CCritHack::GetCritRequest(CUserCmd* pCmd, CTFWeaponBase* pWeapon) +int CCritHack::GetCritRequest(CUserCmd* pCmd, CTFPlayer* pLocal, CTFWeaponBase* pWeapon) { bool bCanCrit = m_iAvailableCrits > 0 && !m_bCritBanned; - bool bPressed = Vars::CritHack::ForceCrits.Value; - if (Vars::CritHack::AlwaysMeleeCrit.Value && m_bMelee + + bool bForce = bCanCrit && Vars::CritHack::ForceCrits.Value; + if (bCanCrit && m_bMelee && Vars::CritHack::AlwaysMeleeCrit.Value && (Vars::Aimbot::General::AutoShoot.Value ? pCmd->buttons & IN_ATTACK && !(G::OriginalCmd.buttons & IN_ATTACK) : Vars::Aimbot::General::AimType.Value) && G::AimTarget.m_iEntIndex) { auto pEntity = I::ClientEntityList->GetClientEntity(G::AimTarget.m_iEntIndex)->As(); - if (pEntity && pEntity->IsPlayer()) - bPressed = true; + if (pEntity && pEntity->IsPlayer() && (SDK::FriendlyFire() || pLocal->m_iTeamNum() != pEntity->m_iTeamNum())) + bForce = true; } bool bSkip = Vars::CritHack::AvoidRandomCrits.Value; bool bDesync = CommandToSeed(pCmd->command_number) == pWeapon->m_iCurrentSeed(); - return bCanCrit && bPressed ? CritRequestEnum::Crit : bSkip || bDesync ? CritRequestEnum::Skip : CritRequestEnum::Any; + return bForce ? CritRequestEnum::Crit : bSkip || bDesync ? CritRequestEnum::Skip : CritRequestEnum::Any; } void CCritHack::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) @@ -356,7 +357,7 @@ void CCritHack::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd) if (!bAttacking || pWeapon->IsRapidFire() && I::GlobalVars->curtime < pWeapon->m_flLastRapidFireCritCheckTime() + 1.f) return; - int iRequest = GetCritRequest(pCmd, pWeapon); + int iRequest = GetCritRequest(pCmd, pLocal, pWeapon); if (iRequest == CritRequestEnum::Any) return; @@ -391,7 +392,7 @@ int CCritHack::PredictCmdNum(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd if (pWeapon->IsRapidFire() && I::GlobalVars->curtime < pWeapon->m_flLastRapidFireCritCheckTime() + 1.f) return iCommandNumber; - int iRequest = GetCritRequest(pCmd, pWeapon); + int iRequest = GetCritRequest(pCmd, pLocal, pWeapon); if (iRequest == CritRequestEnum::Any) return iCommandNumber; diff --git a/Amalgam/src/Features/CritHack/CritHack.h b/Amalgam/src/Features/CritHack/CritHack.h index 0c521dfe..5c9ca2a6 100644 --- a/Amalgam/src/Features/CritHack/CritHack.h +++ b/Amalgam/src/Features/CritHack/CritHack.h @@ -27,7 +27,7 @@ private: void UpdateWeaponInfo(CTFPlayer* pLocal, CTFWeaponBase* pWeapon); void UpdateInfo(CTFPlayer* pLocal, CTFWeaponBase* pWeapon); - int GetCritRequest(CUserCmd* pCmd, CTFWeaponBase* pWeapon); + int GetCritRequest(CUserCmd* pCmd, CTFPlayer* pLocal, CTFWeaponBase* pWeapon); void Reset(); void StoreHealthHistory(int iIndex, int iHealth, CTFPlayer* pPlayer = nullptr); diff --git a/Amalgam/src/Hooks/Cbuf_ExecuteCommand.cpp b/Amalgam/src/Hooks/Cbuf_ExecuteCommand.cpp index 58e0ed91..ae94d3ac 100644 --- a/Amalgam/src/Hooks/Cbuf_ExecuteCommand.cpp +++ b/Amalgam/src/Hooks/Cbuf_ExecuteCommand.cpp @@ -1,6 +1,7 @@ #include "../SDK/SDK.h" #include "../Features/Commands/Commands.h" +//#include "../Features/Debug/Debug.h" MAKE_SIGNATURE(Cbuf_ExecuteCommand, "engine.dll", "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC ? 48 8B 05 ? ? ? ? 48 8D 3D", 0x0); @@ -15,6 +16,8 @@ MAKE_HOOK(Cbuf_ExecuteCommand, S::Cbuf_ExecuteCommand(), void, { DEBUG_RETURN(Cbuf_ExecuteCommand, args, source); + //F::Debug.AddText(args.GetCommandString(), I::GlobalVars->curtime + 1.f); + if (args.ArgC()) { const char* sCommand = args[0]; diff --git a/Amalgam/src/SDK/SDK.cpp b/Amalgam/src/SDK/SDK.cpp index 232c563c..cce5bcba 100644 --- a/Amalgam/src/SDK/SDK.cpp +++ b/Amalgam/src/SDK/SDK.cpp @@ -423,10 +423,15 @@ bool SDK::PredictOrigin(Vec3& vOut, const Vec3& vOrigin, const Vec3& vVelocity, float SDK::GetGravity() { static auto sv_gravity = H::ConVars.FindVar("sv_gravity"); - return sv_gravity->GetFloat(); } +bool SDK::FriendlyFire() +{ + static auto mp_friendlyfire = H::ConVars.FindVar("mp_friendlyfire"); + return mp_friendlyfire->GetBool(); +} + bool SDK::IsLoopback() { auto pNetChan = I::EngineClient->GetNetChannelInfo(); diff --git a/Amalgam/src/SDK/SDK.h b/Amalgam/src/SDK/SDK.h index 7bfa0c88..bc34697e 100644 --- a/Amalgam/src/SDK/SDK.h +++ b/Amalgam/src/SDK/SDK.h @@ -125,6 +125,7 @@ namespace SDK bool PredictOrigin(Vec3& vOut, const Vec3& vOrigin, const Vec3& vVelocity, float flLatency, bool bTrace = true, const Vec3& vMins = {}, const Vec3& vMaxs = {}, unsigned int nMask = MASK_SOLID, float flNormal = 0.f); float GetGravity(); + bool FriendlyFire(); bool IsLoopback(); int GetRoundState(); int GetWinningTeam();