local playerId = PlayerId()
local isHandcuffed = false
local function whileCuffed()
while isHandcuffed do
local playerPed = PlayerPedId()
if not (IsPedRagdoll(playerPed) or IsPedGettingUp(playerPed)) and not IsEntityPlayingAnim(playerPed, 'mp_arresting', 'idle', 3) then
TaskPlayAnim(playerPed, 'mp_arresting', 'idle', 8.0, -8, -1, 49, 0.0, false, false, false)
end
DisablePlayerFiring(playerId, true)
DisableControlAction(0, 140, true)
Wait(0)
end
end
local function setPlayerInHandcuffs(state)
local playerPed = PlayerPedId()
SetEnableHandcuffs(playerPed, state)
isHandcuffed = state
if state then
RequestAnimDict('mp_arresting')
while not HasAnimDictLoaded('mp_arresting') do Wait(0) end
SetCurrentPedWeapon(playerPed, `WEAPON_UNARMED`, true)
CreateThread(whileCuffed)
else
RemoveAnimDict('mp_arresting')
StopAnimTask(playerPed, 'mp_arresting', 'idle', 2.0)
end
end
setPlayerInHandcuffs(true)