[Release] Smooth Crouch Script (v0.93a) (UPDATED: 28.04.2021)

NOTICE (4th May. 2021): The development version of this resource currently replaces the floating ads animation with the default stealth animation. This is the best implementation i’ve found so far and I’ll upload the next version after I cleaned up the code. My to-do list has been updated to include an export function for walk-styles to fix compatibility issues with other resources. If you have a request to make this mod compatible with another mod then plese mention that in the comments.

NOTICE (23st Apr. 2021): I’m back and have started working on this script again. So far I have found several workarounds to the “hovering above ground” bug that involve disabling the native aim camera. The result is the player no longer hovering above ground while aiming at the cost of aim zoom. THIS PROJECT IS OPEN SOURCE so feel free to use, modify and/or release my code as you please as long as credit is given. You can also contact me via Discord for support of any kind: Eddie#6034

I’ve noticed that current crouch scripts out there are somewhat clunky so i decided to make full use of the games’ native animation system to create smooth transitions and make it less intrusive control-wise.

Demo: v0.9

GitHub: v0.93 Alpha

GitHub: v0.92 Alpha

GitHub: v0.91 (Hotfix)

GitHub: v0.9

Features:

  • Ability to shoot in all stances.
  • Modifiable movement speeds for each stance (v0.92a).
  • The stealth animation can now be used for aiming down sights.
  • Jumping or falling resets stance (configurable in v0.92a and later).

Controls:

  • Press Ctrl to toggle crouch / change stance (configurable in v0.92a and later).

Known Issues:

  • Requires testing.
  • May or may not override certain clipsets.
  • Does not work with AI wanted level as the game overrides “Action Mode” for character animations.
  • Does not fully work in first person.
  • When crouched while in low cover it is possible to shoot through that cover without beeing visible to the targeted player/ped.

To-do list:

  • Make aspects of the mod configurable.
  • Add prone stance.
  • Fix hitbox so the player can crouch under objects.
  • Make fully compatible with first person.
  • Fix issues.
  • Add compatibility to requested resources.

Changelog:

v0.91

  • Increased movement speed while aiming.

v0.92 Alpha

  • Movement speeds are configurable via the client/main.lua.

  • Code has been cleaned up, optimized and structured for better readability.

  • Fixed an issue where spamming the crouch button causes head-bobbing (due to the game trying to enter stealth mode inbetween ticks) and allows some weapons to shoot faster while doing so (Thanks to Auraa for reporting the issue).

v0.93 Alpha

  • Added weapon animations to prevent clipping. This currently only discriminates based on weapon type so some more special weapons are still clipping.

  • Fixed an issue where playermodels are floating above the ground while aiming. The workaround for this can be adjusted in the main.lua config section. Mode 3 entirely removes the native aim mode. This means that you are no longer able to zoom in with weapons or use the sniper scope.

  • Disabled first person camera for when crouching due to missing first person animations.

38 Likes

Nice work

1 Like

doesn’t work

1 Like

How so? Does the script load at all? It would be nice if you could check your server logs.

Also make sure you paste the “crouch” folder with the fxmanifest inside the resource folder and not the “Smooth-Crouch-Script-main”.

good job :+1:

2 Likes

With this version, you can no longer walk fast while aiming standing up, it defaults you to walk slow only while aiming and standing so I cannot use this.

1 Like

Movement modifiers will be part of the config in the next version.

1 Like

Is there no way now to edit it so when not crouched, just normally there, and you aim a gun, it doesn’t make you in stealth mode automatically, like not crouching or anything it’s automatically making my character walk slow “stealth mode” while aiming and shift doesn’t make me run faster…

2 Likes
		else
			cor.actionmodeoff = true
			SetPedUsingActionMode(playerped, false, -1, "DEFAULT_ACTION")
			if IsPlayerFreeAiming(player) then
				SetPedMaxMoveBlendRatio(playerped, 1.0)
				SetPedStealthMovement(playerped, true, "DEFAULT_ACTION")
				stealth.on = true
				--notify("PLAYER AIMING")
			else
				SetPedStealthMovement(playerped, false, "DEFAULT_ACTION")
				stealth.on = false
				if IsAimCamActive() or IsAimCamThirdPersonActive() then
					--notify("PLAYER FREE-AIMING")
					SetPedMaxMoveBlendRatio(playerped, 10.0)
				else
					SetPedMaxMoveBlendRatio(playerped, 10.0)	
				end
			end

In the main.lua just remove that whole part at the end and that should fix it you should be able to run again while aiming while not being crouched Idk or think it removed any other essential part of the script because I just did that and the script is still running fine withoutn that part

1 Like

Yea that should work for now. Like I said I’ll add some extra options in the next upload so this can be done via config.

yeah but just noticed that to actually start crouching you need to move after pressing ctrl if you just press it and don’t move then you just keep standing after deleting the part of the main.lua

1 Like

Try just commenting out both lines with ```
SetPedMaxMoveBlendRatio(playerped, 10.0)

That's what changes the aim-walking speeds.

It’s been some time since I actually wrote the code so sorry for the lackluster support.

Alternatively you can just increase the blend-ratio for a faster speed. If I remember correctly that line is actually needed to reset the speed from beeing crouched.

I just tested it again and you have to simply place the value as marked below.

else
cor.actionmodeoff = true
SetPedUsingActionMode(playerped, false, -1, “DEFAULT_ACTION”)
if IsPlayerFreeAiming(player) then
SetPedMaxMoveBlendRatio(playerped, 10.0) – <------ HERE
SetPedStealthMovement(playerped, true, “DEFAULT_ACTION”)
stealth.on = true
–notify(“PLAYER AIMING”)

1 Like

v0.91

  • Increased movement speed while aiming.
1 Like

I can crouch when I use him, but he loses his left Ctrl alert status. I’ve tried to change his buttons, but again I can’t use the alert state, is there any way to make them compatible? :innocent:

1 Like

You are a god. This is now the most perfect public crouch release ever. Thank you.

2 Likes

Thanks man, tried it and working fine so far for me :smiley: will let you know if there was any problem

2 Likes