Handcuffed, animation canceled when movement

Hello, when I set a anim if the player is cuffed, we can see him cuffed and when he moved the animation is automatically cancel, can someone help me please ?

if IsHandcuffed then

      RequestAnimDict('mp_arresting')

			while not HasAnimDictLoaded('mp_arresting') do
				Citizen.Wait(0)
			end

			local myPed = PlayerPedId(-1)
			local animation = 'idle'
			local flags = 16
			
			while(IsPedBeingStunned(myPed, 0)) do
				ClearPedTasksImmediately(myPed)
			end
			TaskPlayAnim(myPed, 'mp_arresting', animation, 8.0, -8, -1, flags, 0, 0, 0, 0)

    end

I think your animation flags are off/incorrect, not 100% sure though.

You can take a look at a working version I created a long time ago, but actually never released before. It uses different flag and I have not had any issues where it’d suddenly remove the animation when you start moving.
Link Here

1 Like