I am using a Police script where we can Cuff/Uncuff people, everything is working good, but the Controls aren’t disabled when the player is cuffed.
He can still Punch/shoot weapons and sometimes even crouch…
Here is the code…
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
if isEscorted then
DisableAllControlActions(0)
EnableControlAction(0, 1, true)
EnableControlAction(0, 2, true)
EnableControlAction(0, Keys['T'], true)
EnableControlAction(0, Keys['E'], true)
EnableControlAction(0, Keys['ESC'], true)
end
if isHandcuffed then
DisableControlAction(0, 24, true) -- Attack
DisableControlAction(0, 257, true) -- Attack 2
DisableControlAction(0, 25, true) -- Aim
DisableControlAction(0, 263, true) -- Melee Attack 1
DisableControlAction(0, Keys['R'], true) -- Reload
DisableControlAction(0, Keys['SPACE'], true) -- Jump
DisableControlAction(0, Keys['Q'], true) -- Cover
DisableControlAction(0, Keys['TAB'], true) -- Select Weapon
DisableControlAction(0, Keys['F'], true) -- Also 'enter'?
DisableControlAction(0, Keys['F1'], true) -- Disable phone
DisableControlAction(0, Keys['F2'], true) -- Inventory
DisableControlAction(0, Keys['F3'], true) -- Animations
DisableControlAction(0, Keys['F6'], true) -- Job
DisableControlAction(0, Keys['C'], true) -- Disable looking behind
DisableControlAction(0, Keys['X'], true) -- Disable clearing animation
DisableControlAction(2, Keys['P'], true) -- Disable pause screen
DisableControlAction(0, 59, true) -- Disable steering in vehicle
DisableControlAction(0, 71, true) -- Disable driving forward in vehicle
DisableControlAction(0, 72, true) -- Disable reversing in vehicle
DisableControlAction(2, Keys['LEFTCTRL'], true) -- Disable going stealth
DisableControlAction(0, 264, true) -- Disable melee
DisableControlAction(0, 257, true) -- Disable melee
DisableControlAction(0, 140, true) -- Disable melee
DisableControlAction(0, 141, true) -- Disable melee
DisableControlAction(0, 142, true) -- Disable melee
DisableControlAction(0, 143, true) -- Disable melee
DisableControlAction(0, 75, true) -- Disable exit vehicle
DisableControlAction(27, 75, true) -- Disable exit vehicle
if (not IsEntityPlayingAnim(GetPlayerPed(-1), "mp_arresting", "idle", 3) and not IsEntityPlayingAnim(GetPlayerPed(-1), "mp_arrest_paired", "crook_p2_back_right", 3)) and not QBCore.Functions.GetPlayerData().metadata["isdead"] then
loadAnimDict("mp_arresting")
TaskPlayAnim(GetPlayerPed(-1), "mp_arresting", "idle", 8.0, -8, -1, cuffType, 0, 0, 0, 0)
end
end
if not isHandcuffed and not isEscorted then
Citizen.Wait(2000)
end
end
end)
I had tried printing isCuffed and it returns true when the player is cuffed. His hands are also tied up behind… But the controls aren’t getting disabled…
Any ideas where I should be looking?