Skip to content

Commit d37207f

Browse files
xen-000Vauff
authored andcommitted
Add weapon hiding
1 parent e6ad163 commit d37207f

4 files changed

Lines changed: 18 additions & 0 deletions

File tree

cfg/cs2fixes/cs2fixes.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ cs2f_burn_slowdown 0.6 // The slowdown of each burn damage tick as a multipl
5555
cs2f_burn_interval 0.3 // The interval between burn damage ticks
5656

5757
// Hide settings
58+
cs2f_hide_weapons 0 // Whether to hide weapons along with their holders
5859
cs2f_hide_distance_default 250 // The default distance for hide
5960
cs2f_hide_distance_max 2000 // The max distance for hide
6061
cs2f_hide_teammates_only 0 // Whether to hide teammates only

src/commands.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ CON_COMMAND_CHAT(noshake, "- toggle noshake")
431431
}
432432

433433
CConVar<bool> g_cvarEnableHide("cs2f_hide_enable", FCVAR_NONE, "Whether to enable hide (WARNING: randomly crashes clients since 2023-12-13 CS2 update)", false);
434+
CConVar<bool> g_cvarHideWeapons("cs2f_hide_weapons", FCVAR_NONE, "Whether to hide weapons along with their holders", false);
434435
CConVar<int> g_cvarDefaultHideDistance("cs2f_hide_distance_default", FCVAR_NONE, "The default distance for hide", 250, true, 0, false, 0);
435436
CConVar<int> g_cvarMaxHideDistance("cs2f_hide_distance_max", FCVAR_NONE, "The max distance for hide", 2000, true, 0, false, 0);
436437

src/commands.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ extern CConVar<bool> g_cvarEnableStopSound;
3333
extern CConVar<bool> g_cvarEnableNoShake;
3434
extern CConVar<float> g_cvarMaxShakeAmp;
3535
extern CConVar<bool> g_cvarEnableHide;
36+
extern CConVar<bool> g_cvarHideWeapons;
3637

3738
#define CMDFLAG_NONE (0)
3839
#define CMDFLAG_NOHELP (1 << 0) // Don't show in !help menu

src/cs2fixes.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,22 @@ void CS2Fixes::Hook_CheckTransmit(CCheckTransmitInfo** ppInfoList, int infoCount
10521052
// Do not hide leaders or item holders to other players
10531053
ZEPlayer* pOtherZEPlayer = g_playerManager->GetPlayer(j);
10541054
if (pSelfZEPlayer->ShouldBlockTransmit(j) && pOtherZEPlayer && !pOtherZEPlayer->IsLeader() && g_pEWHandler->FindItemInstanceByOwner(j, false, 0) == -1)
1055+
{
10551056
pInfo->m_pTransmitEntity->Clear(pPawn->entindex());
1057+
1058+
if (g_cvarHideWeapons.Get())
1059+
{
1060+
auto pVecWeapons = pPawn->m_pWeaponServices->m_hMyWeapons();
1061+
1062+
FOR_EACH_VEC(*pVecWeapons, i)
1063+
{
1064+
auto pWeapon = (*pVecWeapons)[i].Get();
1065+
1066+
if (pWeapon)
1067+
pInfo->m_pTransmitEntity->Clear(pWeapon->entindex());
1068+
}
1069+
}
1070+
}
10561071
}
10571072

10581073
// Don't transmit glow model to it's owner

0 commit comments

Comments
 (0)