VRP police arrest animations

how to get this animations to vrp

2 Likes

There should be some sort of clientside saying PlayTaskAnim or something along thoes lines. in your policejob resourse. but idk i use ESX

how to get to vrp

under your police.client you would change the Anim.

 -- task: keep handcuffed animation
  Citizen.CreateThread(function()
    while true do
      Citizen.Wait(15000)
      if self.handcuffed then
        vRP.EXT.Base:playAnim(true,{{"mp_arresting","idle",1}},true)
      end
    end
  end)

im not sure if it will attach both peds to the animation tho.

realy we neeed it for vrp … we are Oppressed!!!

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

Where should i add this or should i create a client file ?

vrp/client/police.lua

Its worked Thanks. But only for the one who i arrest there is no animation for the police side only citizen side worked any fix ??

Well I have my handcuffs for my pd bound to a key. The function that the key is bound to is:

function vRPhk.toggleHandcuff()
    local user_id = vRP.getUserId({source})
	local player = vRP.getUserSource({user_id})
    if vRP.hasPermission({user_id,"police.pc"}) then
		vRPclient.getNearestPlayer(player,{2},function(nplayer)
			if nplayer ~= nil then
				vRPclient.toggleHandcuff(nplayer)
				vRPclient.Handcuffer(player)
			else
				vRPclient.notify(player,{"~r~No person near you"})
			end
		end)
    end
end
2 Likes

You are awsome!!! everything works as it should be, except one thing which is whenever a player(police) cuff nplayer(citizen) there is auto freez for the cuffed persion cant move or do any action is that normal ?

Hello friend, thanks for sharing the animation with us, I only have one doubt. Where do you put this part of the code? I put it in vrp / client / police.lua, when I enter the server I can’t get the phone from the vrp. Regards (google translator)

The toggle handcuff function, I have that in my hotkeys script and not in the base framework of vrp.

Hi friends, I have a question. I’m putting the code in a hotkeys script but it really didn’t work out, I don’t know if I’m doing something wrong. Could you help me?

[213] = {
    -- HOME cuff
    group = 0, 
	pressed = function() 
	  HKserver.toggleHandcuff()
	end,
	released = function()
	 
	end,
  },
[289] = {
	-- F2 Handcuff/uncuff
	group = 1,
	pressed = function()
		if not IsPauseMenuActive() and not IsPedInAnyVehicle(GetPlayerPed(-1), true) then
			HKserver.toggleHandcuff()
		end 
	end,
	released = function()
	end,
  },

where i put this?

vrp/hotkeys

its works , but i want the player still move after handcuff, how?

2 Likes
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.stopAnim(false)
  tvRP.playAnim(true,{{"mp_arresting","idle",1}},true)
  else
    tvRP.playAnim(false,{{"mp_arresting","b_uncuff"}},true)
    Citizen.Wait(4500)
    Citizen.Wait(1500)
    tvRP.stopAnim(false)
    SetPedStealthMovement(GetPlayerPed(-1),false,"") 
  end
end

just stop the first anim before the idle like this and he can move again