You can try this. Have NOT tested it. (0, 51) should be “E”
function loadAnimDict( dict )
while ( not HasAnimDictLoaded( dict ) ) do
RequestAnimDict( dict )
Citizen.Wait( 5 )
end
end
Citizen.CreateThread(function()
while true do
Wait(0)
local player = GetPlayerPed( -1 )
if ( DoesEntityExist( player ) and not IsEntityDead( player )) then
loadAnimDict( "random@arrests" )
loadAnimDict( "random@arrests@busted" )
if IsControlJustPressed(0, 51) then --------------------------------------------------------------------Change the key here
if ( IsEntityPlayingAnim( player, "random@arrests@busted", "idle_a", 3 ) ) then
TaskPlayAnim( player, "random@arrests@busted", "exit", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
Wait (3000)
TaskPlayAnim( player, "random@arrests", "kneeling_arrest_get_up", 8.0, 1.0, -1, 128, 0, 0, 0, 0 )
else
TaskPlayAnim( player, "random@arrests", "idle_2_hands_up", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
Wait (4000)
TaskPlayAnim( player, "random@arrests", "kneeling_arrest_idle", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
Wait (500)
TaskPlayAnim( player, "random@arrests@busted", "enter", 8.0, 1.0, -1, 2, 0, 0, 0, 0 )
Wait (1000)
TaskPlayAnim( player, "random@arrests@busted", "idle_a", 8.0, 1.0, -1, 9, 0, 0, 0, 0 )
end
end
end
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsEntityPlayingAnim(GetPlayerPed(PlayerId()), "random@arrests@busted", "idle_a", 3) then
DisableControlAction(1, 140, true)
DisableControlAction(1, 141, true)
DisableControlAction(1, 142, true)
DisableControlAction(0,21,true)
end
end
end)