[ESX] MSK Handcuffs - Realistic Handcuffs

Tebex [5.99€ incl. VAT] - Encrypted
Tebex [9.99€ incl. VAT] - Only serverside encrypted
Documentation
YouTube Preview

Description

  • Cuff, Hardcuff or Uncuff the closest Player
  • Drag and Undrag the closest Player
  • Cuff players with items
  • Cuff players with commands
  • Timer for uncuff players
  • Animations and Sounds
  • Admin commands
  • Cuff Status will be saved to database and restored after relog
  • Example to implement this in esx_policejob [Read the Readme.md]
  • Discord Logs

Config

Config = {}
----------------------------------------------------------------
Config.Locale = 'de'
Config.VersionChecker = true
Config.Debug = true
----------------------------------------------------------------
-- Add the Webhook Link in server_discordlog.lua
Config.DiscordLog = true
Config.botColor = "6205745" -- https://www.mathsisfun.com/hexadecimal-decimal-colors.html
Config.botName = "MSK Scripts"
Config.botAvatar = "https://i.imgur.com/PizJGsh.png"
----------------------------------------------------------------
-- !!! This function is clientside AND serverside !!!
-- Look for type == 'client' and type == 'server'
Config.Notification = function(src, action, xPlayer, message) -- xPlayer = ESX.GetPlayerFromId(src)
    if action == 'client' then -- clientside
        MSK.Notification(message) -- replace this with your Notify
    elseif action == 'server' then -- serverside
        MSK.Notification(src, message) -- replace this with your Notify
    end
end
----------------------------------------------------------------
-- You have to use 'cuffItems' before you can use 'hardcuffItems'

-- If you use a Command then always the first item inside the table will be used
-- So with {'cuffs', 'cable_ties'} always item 'cuffs' will be used for Commands

-- You can set multiple items // Add them in your database
Config.cuffItems = {'cuffs', 'cable_ties'} -- DisableAllControlActions exept Movement
Config.hardcuffItems = {'hardcuff'} -- Freeze Player Position
Config.uncuffItems = {'cuff_keys', 'scissors'} -- Uncuff a Player
----------------------------------------------------------------
Config.InteractSound = true -- You need InteractSound for that (https://github.com/plunkettscott/interact-sound/releases)
Config.checkOnPlayerLoaded = true -- Check cuff status from DB if the player join the server and cuffs the player if cuff Stauts is true
Config.addCuffItems = true -- Set to false if you don't want to give the cuffs item back if you uncuff someone
----------------------------------------------------------------
Config.Timer = {
    enable = true, -- Set false to disable this feature
    time = 30 -- in minutes // After this time the player gets uncuffed
}
----------------------------------------------------------------
-- Player Commands
Config.PlayerCommands = {
    cuffCommand = 'cuff', -- default: 'cuff' // Set false if you dont want the Command
    hardcuffCommand = 'hardcuff', -- default: 'hardcuff' // Set false if you dont want the Command
    uncuffCommand = 'uncuff', -- default: 'uncuff' // Set false if you dont want the Command

    dragCommand = 'drag', -- default: 'drag' // Drags the closest Player // Set false if you dont want the Command
    undragCommand = 'undrag' -- default: 'undrag' // Undrags the closest Player // Set false if you dont want the Command
}
----------------------------------------------------------------
-- Admin Commands
Config.AdminGroups = {'superadmin', 'admin'} -- You can set multiple groups
Config.AdminCommands = {
    cuffCommand = 'adcuff', -- default: 'cuff' // example: /cuff playerID
    hardcuffCommand = 'adhardcuff', -- default: 'hardcuff' // example: /adhardcuff playerID
    uncuffCommand = 'aduncuff' -- default: 'uncuff' // example: /aduncuff playerID
}
----------------------------------------------------------------
-- !!! This functions are clientside ONLY !!!
-- To deactivate the Radio Channel if someone is handcuffes
Config.Voice = false -- Set to 'salty', 'pma' or false to deactivate this feature

Config.SetRadioChannel = function()
    if not Config.Voice then return end

    if Config.Voice:match('salty') then
        exports["saltychat"]:SetRadioChannel("", true) -- https://github.com/v10networkscom/saltychat-fivem#setradiochannel
    elseif Config.Voice:match('pma') then
        exports["pma-voice"]:setVoiceProperty("radioEnabled", false) -- https://github.com/AvarianKnight/pma-voice/blob/main/docs/client-setters/setVoiceProperty.md
        exports["pma-voice"]:SetRadioChannel(0) -- https://github.com/AvarianKnight/pma-voice/blob/main/docs/client-setters/setRadioChannel.md
    end
end
----------------------------------------------------------------
-- !!! This functions are clientside ONLY and inside a Thread (triggerd every frame) !!!
Config.Method = 'whitelist' -- Set to 'whitelist' or 'blacklist'

-- This is triggerd if the player gets cuffed
Config.Handcuffed = function()
    if Config.Method:match('whitelist') then
        EnableControlAction(0, 1, true) -- Camera Movement
        EnableControlAction(0, 2, true) -- Camera Movement
        EnableControlAction(0, 245, true) -- T
        EnableControlAction(0, 23, true) -- F (Enter Vehicle)
        EnableControlAction(0, 75, true) -- F (Exit Vehicle)
    elseif Config.Method:match('blacklist') 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, 45, true) -- Reload

		DisableControlAction(0, 22, true) -- Jump
		DisableControlAction(0, 44, true) -- Cover
		DisableControlAction(0, 37, true) -- Select Weapon

		DisableControlAction(0, 288,  true) -- F1
		DisableControlAction(0, 289, true) -- F2
		DisableControlAction(0, 170, true) -- F3
		DisableControlAction(0, 167, true) -- F6 
        DisableControlAction(0, 73, true) -- X
		DisableControlAction(2, 199, true) -- P

        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, 36, true) -- Disable going stealth
        DisableControlAction(0, 47, true)  -- Disable weapon
		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
    end
end

-- This is triggerd if the player gets uncuffed
Config.notHandcuffed = function()
    -- Add your code here
end

Optional Requirements

Code is accessible No
Subscription-based No
Lines (approximately) ~460
Requirements ESX 1.2 and above, oxmysql, msk_core
Support Yes

My other Scripts

Paid

Free

4 Likes

Question: Does this make the ped like an entity? Like other handcuffs, which nullifies all ped based commands?

No, the Ped is still a Ped not an entity.

Option to disable the animation in the config would be nice and can you make the message editable because in my case okokNotify dont support colors in the message (f.e. ~r~) and they are set in the encrypted files atm.

So far nice scipt and working very well.

1 Like

No, the Translations are in translation.lua you can access this file

Why not use statebag for this? No need database request.

You should add config for disablecontrolactions as you cant speak or do much when cuffed when you should be able to, also is there any chance to get a semi open source version so we can add minigames etc to the cuffing? Also not much info for the readme, its only for police but no just uncuff or cuff exports meaning you have to have the item

I will add a function where you can add the DisabledControlKeys by youself with the next Update. Sure you have to have the item to cuff or uncuff someone.

I mean like say for certain events where there is no player a that needs cuffs since its the event that triggers the event if that makes sense (eg jail script where you get sent and are in cuffs or something)

xPlayer.triggerEvent('msk_handcuffs:checkCuff', item, playerID)

Yeah but that requires a player to have the handcuffs, i mean an event that just handcuffs the player without needing another player to do it so i can trigger it without needing the cop player

Hello, I have some questions, I have been using the script and well, I leave you with a couple of questions

Is there a possibility that the handcuffed user can run or maybe be able to change it at will?

How can I move a handcuffed person? with esx_policejob it was not possible to move a handcuffed player.

1 Like

Question 1: With the latest Update you can add the Controls that you want to active in the config.lua

Question 2: You can use the export in the Readme.md and add it in your policejob. It’s all described in the Readme.md

1 Like

Thanks I will try!!!

still having issue’s with this, players that are not cuffed when flying out sometimes come back in cuffed

Great script, I found just one problem.
The chezza inventory uses the fivem keymapping feature.
Your any block and allowing just some keys doesnt work for me with fivem keymappings.
Players are still able to open the inventory and use for example the uncuff feature on another player.

Is it possible to fix that?

All Controls are disabled you can enable Controls in the config.

UIs like Inventory or Phone can’t be disabled with Controls. Therefore you have to use the exports and Callback described in Readme.md

how and i add in the new police ‘1.7.5’ for drag and others

read the readme.md