mirror of
https://github.com/rei-2/Amalgam
synced 2026-10-10 04:43:09 +08:00
don't force crits on teammates unless friendly fire is enabled
This commit is contained in:
@@ -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<CTFPlayer>()->IsAlive() || pEntity->As<CTFPlayer>()->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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -19,9 +19,9 @@ static inline std::vector<Target_t> 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<Target_t> 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<CTFPlayer>()->InCond(TF_COND_BURNING))
|
||||
continue;
|
||||
|
||||
@@ -31,9 +31,9 @@ static inline std::vector<Target_t> 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<Target_t> 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);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ static inline std::vector<Target_t> 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
|
||||
|
||||
@@ -114,7 +114,7 @@ bool CAutoDetonate::CheckEntities(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUs
|
||||
sphere.NextEntity())
|
||||
{
|
||||
if (pEntity == pLocal || pEntity->IsPlayer() && (!pEntity->As<CTFPlayer>()->IsAlive() || pEntity->As<CTFPlayer>()->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;
|
||||
|
||||
|
||||
@@ -477,7 +477,7 @@ void CAutoHeal::GetDangers(CTFPlayer* pTarget, bool bVaccinator, float& flBullet
|
||||
pOwner = pWeapon ? pWeapon->m_hOwner()->As<CTFPlayer>() : 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;
|
||||
|
||||
|
||||
@@ -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<CBaseEntity>();
|
||||
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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user