VRP police arrest animations

I did this awhile ago. It can still be improved though.

local handcuffed = false
local cuffed = false

function tvRP.toggleHandcuff()
  handcuffed = not handcuffed

  SetEnableHandcuffs(GetPlayerPed(-1), handcuffed)
  if handcuffed then
  
  tvRP.playAnim(false,{{"mp_arrest_paired","crook_p2_back_right",1}},true)
  Citizen.Wait(3760)
  tvRP.playAnim(false,{{"mp_arresting","idle",1}},true)
	TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 10, 'Cuff', 0.1)
  else
    tvRP.playAnim(false,{{"mp_arresting","b_uncuff"}},true)
    Citizen.Wait(4500)
    TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 10, 'Uncuff', 0.1)
    Citizen.Wait(1500)
    tvRP.stopAnim(false)
    SetPedStealthMovement(GetPlayerPed(-1),false,"") 
  end
end

function tvRP.Handcuffer()
  cuffed = not cuffed
  if cuffed then
    tvRP.playAnim(true,{{"mp_arrest_paired","cop_p2_back_right",1}},true)
    Citizen.Wait(3500)
    tvRP.stopAnim(true)
  else
    tvRP.playAnim(true,{{"mp_arresting","a_uncuff",1}},true)
    Citizen.Wait(5500)
    tvRP.stopAnim(true)
  end
end

function tvRP.setHandcuffed(flag)
  if handcuffed ~= flag then
    tvRP.toggleHandcuff()
  end
end

function tvRP.isHandcuffed()
  return handcuffed
end
1 Like