Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions Client/mods/deathmatch/logic/CClientPed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3122,14 +3122,10 @@ void CClientPed::ApplyControllerStateFixes(CControllerState& Current)
// Disable the fire keys whilst crouching as well
Current.ButtonCircle = 0;
Current.LeftShoulder1 = 0;
if (m_ulLastTimeBeganCrouch >= ulNow - 400.0f * fSpeedRatio)
{
// Disable double crouching (another anim cut)
if (g_pClientGame->IsUsingAlternatePulseOrder())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know how alternate pulse order works but it looks like this code was introduced here: cd9473b

According to https://web.archive.org/web/20200809114050/https://bugs.mtasa.com/view.php?id=7250

Description
When the server's configuration parameter <vehext_percent> is greater than zero, then all players can not crouch always

Steps to reproduce

  • Add or set in mtaserver.conf parameter <vehext_percent> to 1-100
  • Start the server and to try crouch

However those repro steps will not work today because the implementation of IsUsingAlternatePulseOrder has changed.

Today, IsUsingAlternatePulseOrder is managed by the latency_reduction setting (default 0).


Please can you confirm that this code does not break crouching when using <latency_reduction>1</latency_reduction>?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am testing this now

Copy link
Member

@qaisjp qaisjp Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your patch? latency_reduction = 0 latency_reduction = 1
Not applied Holding crouch immediately stands up Holding crouch works properly
Applied Holding crouch works properly Holding crouch works properly

Which means that your patch works with any latency_reduction state, great.

But we should also test to make sure we've haven't reintroduced this exploit:

// If we started crouching less than some time ago, make sure we can't jump or sprint.
// This fixes the exploit both locally and remotely that enables players to abort
// the crouching animation and shoot quickly with slow shooting weapons. Also fixes
// the exploit making you able to get crouched without being able to move and shoot
// with infinite ammo for remote players.

Does anyone know how to trigger this exploit?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found info on https://gta.fandom.com/wiki/Desert_Eagle

It is possible to use a bug to make the gun shoot faster by doing this: Aim, fire, release both fire and aim, click the crouch button, and repeat. This bug also works via the "free aim" option in the controls menu. Choosing this, the player can rapidly tap the fire button over and over, making the weapon fire far faster. This applies to the other pistols as well.

I can't test this right now but someone should test to make sure we haven't unintentionally restored that exploit

Current.ShockButtonL = 255; // Do this differently if we have changed the pulse order
else
Current.ShockButtonL = 0;
}

// Disable double crouching (another anim cut)
if (ulNow - m_ulLastTimeBeganCrouch < 500 * fSpeedRatio)
Copy link
Member

@qaisjp qaisjp Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

m_ulLastTimeBeganCrouch >= ulNow - 400.0f * fSpeedRatio

is equivalent to

ulNow - m_ulLastTimeBeganCrouch < 500 * fSpeedRatio

But can you explain the change from 400.0f500

Why did you change this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw I think your new code is clearer so you should change line 3115 too

Current.ShockButtonL = IsDucked() ? 255 : 0;
}
}
// If we just started aiming, make sure they dont try and crouch
Expand Down Expand Up @@ -7269,4 +7265,3 @@ void CClientPed::RunSwimTask() const

inWaterTask->SetAsPedTask(m_pPlayerPed, TASK_PRIORITY_EVENT_RESPONSE_NONTEMP, true);
}

Loading