Skip to content

Commit ced74d2

Browse files
2vgVauff
andauthored
feat: duck spam (#448)
* feat: duck spam * Match default duck speed, rename cvar & add to .cfg --------- Co-authored-by: Vauff <mctehkitti@gmail.com>
1 parent 173fcb9 commit ced74d2

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

cfg/cs2fixes/cs2fixes.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cs2f_stopsound_enable 0 // Whether to enable stopsound
77
cs2f_noblock_enable 0 // Whether to use player noblock, which sets debris collision on every player
88
cs2f_noblock_grenades 0 // Whether to use noblock on grenade projectiles
99
cs2f_block_team_messages 0 // Whether to block team join messages
10-
cs2f_movement_unlocker_enable 0 // Whether to enable movement unlocker
10+
cs2f_movement_unlocker_enable 0 // Whether to enable movement unlocker, clients will not predict
1111
cs2f_use_old_push 0 // Whether to use the old CSGO trigger_push behavior (Necessary for surf and other modes that heavily use ported pushes)
1212
cs2f_hide_enable 0 // Whether to enable hide (WARNING: randomly crashes clients since 2023-12-13 CS2 update)
1313
cs2f_votemanager_enable 0 // Whether to enable votemanager features such as map vote fix, nominations, RTV and extends
@@ -26,6 +26,7 @@ cs2f_fix_game_bans 0 // Whether to fix CS2 game bans spreading to all new jo
2626
cs2f_free_armor 0 // Whether kevlar (1+) and/or helmet (2) are given automatically
2727
cs2f_block_particle_msgs 0 // Whether to block CUserMsg_ParticleManager messages to fix lag/crashes, experimental
2828
cs2f_disable_setmodel 0 // Whether to disable SetModel usage from maps (custom input, cs_script function)
29+
cs2f_allow_duck_spam 0 // Whether to allow duck spamming by removing the duck slowdown, clients will only partially predict [0 = disabled, 1 = both teams, 2 = T only, 3 = CT only]
2930
3031
cs2f_beacon_particle "particles/cs2fixes/admin_beacon.vpcf" // .vpcf file to be precached and used for player beacon
3132
cs2f_motd_url "" // Server MOTD URL, shows up as a "Server Website" button in scoreboard

src/detours.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,8 @@ void* FASTCALL Detour_CNavMesh_GetNearestNavArea(int64_t unk1, float* unk2, unsi
538538
return CNavMesh_GetNearestNavArea(unk1, unk2, unk3, unk4, unk5, unk6, unk7);
539539
}
540540

541+
CConVar<int> g_cvarAllowDuckSpam("cs2f_allow_duck_spam", FCVAR_NONE, "Whether to allow duck spamming by removing the duck slowdown, clients will only partially predict [0 = disabled, 1 = both teams, 2 = T only, 3 = CT only]", 0, true, 0, true, CS_TEAM_CT);
542+
541543
void FASTCALL Detour_ProcessMovement(CCSPlayer_MovementServices* pThis, void* pMove)
542544
{
543545
CCSPlayerPawn* pPawn = pThis->GetPawn();
@@ -550,6 +552,11 @@ void FASTCALL Detour_ProcessMovement(CCSPlayer_MovementServices* pThis, void* pM
550552
if (!pController || !pController->IsConnected())
551553
return ProcessMovement(pThis, pMove);
552554

555+
int iAllowDuckSpam = g_cvarAllowDuckSpam.Get();
556+
557+
if ((iAllowDuckSpam == 1 || pPawn->m_iTeamNum() == iAllowDuckSpam) && pThis->m_flDuckSpeed() != 8.0f)
558+
pThis->m_flDuckSpeed = 8.0f;
559+
553560
float flSpeedMod = pController->GetZEPlayer()->GetSpeedMod();
554561

555562
if (flSpeedMod == 1.f)

src/patches.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ CMemPatch g_CommonPatches[] =
3636
CMemPatch("SetSchemaHammerUniqueId", "SetSchemaHammerUniqueId"),
3737
};
3838

39-
CConVar<bool> cs2f_movement_unlocker_enable("cs2f_movement_unlocker_enable", FCVAR_NONE, "Whether to enable movement unlocker", false,
39+
CConVar<bool> cs2f_movement_unlocker_enable("cs2f_movement_unlocker_enable", FCVAR_NONE, "Whether to enable movement unlocker, clients will not predict", false,
4040
[](CConVar<bool>* cvar, CSplitScreenSlot slot, const bool* new_val, const bool* old_val) {
4141
// Movement unlocker is always the first patch
4242
if (*new_val)

0 commit comments

Comments
 (0)