-
-
Notifications
You must be signed in to change notification settings - Fork 530
Fix for the crouch key behavior #4539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Do you mean: This behavior prevents the ped from standing up and requires manually releasing the key to keep the ped from crouching. |
| } | ||
|
|
||
| // Disable double crouching (another anim cut) | ||
| if (ulNow - m_ulLastTimeBeganCrouch < 500 * fSpeedRatio) |
There was a problem hiding this comment.
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.0f → 500
Why did you change this?
There was a problem hiding this comment.
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
| if (m_ulLastTimeBeganCrouch >= ulNow - 400.0f * fSpeedRatio) | ||
| { | ||
| // Disable double crouching (another anim cut) | ||
| if (g_pClientGame->IsUsingAlternatePulseOrder()) |
There was a problem hiding this comment.
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 alwaysSteps 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>?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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:
mtasa-blue/Client/mods/deathmatch/logic/CClientPed.cpp
Lines 3108 to 3112 in a665e01
| // 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?
There was a problem hiding this comment.
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
95a1bb5 to
194a2e8
Compare
Fixed #488
This PR fixes an old bug where holding the crouch key (default: C) causes the ped to stand up after a while, even though the key is still pressed. This behavior prevents the ped from staying crouched and requires manually releasing the key to keep the ped from standing.