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)
1 Like

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