Skip to content

Commit

Permalink
CoF: pattern-less implementation of bypassing the noclip unset
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileyAG authored and YaLTeR committed Mar 13, 2024
1 parent 3ab2543 commit 7ad2ec1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions BunnymodXT/modules/ServerDLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2599,7 +2599,25 @@ HOOK_DEF_1(ServerDLL, void, __cdecl, ClientCommand, edict_t*, pEntity)

HOOK_DEF_1(ServerDLL, void, __cdecl, PlayerPostThink, edict_t*, pEntity)
{
bool noclip_set = false;
if (pEntity && pEntity->pvPrivateData)
{
// In Cry of Fear, the developers reset the noclip in the CBasePlayer::PostThink function as a hidden anti-cheat measure.
// We will set this ourselves after the original function completes if noclip was actually enabled before.
if (CVars::sv_cheats.GetBool())
{
if (is_cof)
{
if (pEntity->v.movetype == MOVETYPE_NOCLIP)
noclip_set = true;
}
}
}

ORIG_PlayerPostThink(pEntity);

if (noclip_set)
pEntity->v.movetype = MOVETYPE_NOCLIP;
}

void ServerDLL::GiveNamedItem(entvars_t *pev, int istr)
Expand Down

0 comments on commit 7ad2ec1

Please sign in to comment.