Disable player attacking stance

I would like to prevent the player’s ped from going to an attacking stance right after shooting or attacking, I’ve tried looking for the native to do so but I couldn’t find it.
Current ped state after shooting:

How I want the ped to behave after shooting:

Something like this in a client script may work.

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(1)
		local ped = PlayerPedId()
		if IsPedUsingActionMode(ped) then
			SetPedUsingActionMode(ped, false, -1, 'DEFAULT_ACTION')
		end
	end
end)
3 Likes

Perfect, thanks.

I noticed it still plays combat stance when you punch, doesn’t happen to weapons though after the solution you gave me, do you know how to disable for punch as well?

I’m not able to do any testing for the interim, bad hdd on my dev system, but you could test out this native, I’ve not used it before myself. This looks like it would just need to be executed once after the player loads into the game but you might also want to test adding it into your loop outside of that if statement if that doesn’t work.

SetDisableAmbientMeleeMove(PlayerId(), true)

Yeah I happened to test that native before but it doesn’t seem to have any effect on the matter. Tried both outside a thread and inside, neither worked. And yeah I tested again now as well.

Try this:

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(1)
		local ped = PlayerPedId()
		if IsPedUsingActionMode(ped) and not GetPedConfigFlag(ped,78,1) then
			SetPedUsingActionMode(ped, false, -1, 0)
		end
	end
end)

If that doesn’t work try this:

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(1)
        local ped = PlayerPedId()
        if IsPedUsingActionMode(ped) then
            SetPedUsingActionMode(ped, false, -1, 'DEFAULT_ACTION')
        end
        if not GetPedConfigFlag(ped,78,1) then
            SetPedUsingActionMode(ped, false, -1, 0)
        end
    end
end)

Neither works unfortunetaly, any other idea? :thinking:

so any solution?

This should work if I’m not mistaken

if IsPedUsingActionMode(ped) then
    SetPedUsingActionMode(ped, -1, -1, 1)
end
2 Likes

Anyone ever get it working with punches? Seems as if the game manually sets you into action mode each frame for about 4 seconds after melee combat, closest I have got to a solution is SetPedResetFlag(ped, 200, true) but it battles with the game and spazzes the ped.

Hi. I have problem with this script and i can’t fix it. Can u add me on discord to help me please ? Discord:rybii

This never got resolved and nor did I find any info on the matter.
If anyone asks.