Guides

All Events and Exports for msk_handcuffs

You need msk_core! - Download it here

General edits in jobs

To let msk_handcuffs work with f.e. esx_policejob or other job scripts, go to esx_policejob/client/main.lua and change a few things.

Jaksam Job Creator

In Version 7.10.2, we can access the following file:

jobs_creator/client/actions/actions.lua

I don't know if you can access this file in other versions... :(

client/actions/actions.lua
{condition = JobsCreator.activeActions.canHandcuff, label = getLocalizedText('actions_put_soft_handcuffs'), value = 'cuff', type = 'player'},
{condition = JobsCreator.activeActions.canHandcuff, label = getLocalizedText('actions_put__hard_handcuffs'), value = 'hardcuff', type = 'player'},
{condition = JobsCreator.activeActions.canHandcuff, label = getLocalizedText('actions_take_handcuffs'), value = 'uncuff', type = 'player'},
{condition = JobsCreator.activeActions.canHandcuff, label = getLocalizedText('actions_start_dragging'), value = 'drag', type = 'player'},
{condition = JobsCreator.activeActions.canHandcuff, label = getLocalizedText('actions_put_in_car'), value = 'putInCar', type = 'player'},
{condition = JobsCreator.activeActions.canHandcuff, label = getLocalizedText('actions_take_from_car'), value = 'takeFromCar', type = 'vehicle'},
client/actions/actions.lua
local function openActionsMenu()
    if not canDoAnyAction or not actionsMenuEnabled or IsPedDeadOrDying(PlayerPedId()) then return end
    if(canDoAnyAction and (not config.canUseActionsMenuWhileOffDuty and not isOnDuty)) then
        notifyClient(getLocalizedText("you_are_not_on_duty"))
        return
    end

    if (exports['msk_handcuffs']:getIsHandcuffed()) then
        notifyClient(getLocalizedText("you_cant_while_handcuffed"))
        return
    end

    Framework.menu().CloseAll()

    Framework.menu().Open('default', GetCurrentResourceName(), 'actions_menu', {
        title = getLocalizedText('actions_menu'),
        align = config.menuPosition,
        elements = menuElements
    }, 
    function(data, menu) 
        local action = data.current.value
        local extraData = data.current.extraData

        if action == 'cuff' then
            exports.msk_handcuffs:cuffPlayer('cuffs')
        elseif action == 'hardcuff' then
            exports.msk_handcuffs:hardcuffPlayer('hardcuff')
        elseif action == 'uncuff' then 
            exports.msk_handcuffs:uncuffPlayer('cuff_keys')
        elseif action == 'drag' then
            local player, distance = ESX.Game.GetClosestPlayer()

            if player ~= -1 and distance <= 2.5 then
                TriggerServerEvent('msk_handcuffs:setDrag', GetPlayerServerId(player))
            end
        elseif action == 'putInCar' then
            local player, distance = ESX.Game.GetClosestPlayer()

            if player ~= -1 and distance <= 2.5 then
                TriggerServerEvent('msk_handcuffs:putInCar', GetPlayerServerId(player))
            end
        elseif action == 'takeFromCar' then
            local player, distance = ESX.Game.GetClosestPlayer()

            if player ~= -1 and distance <= 2.5 then
                TriggerServerEvent('msk_handcuffs:outOfCar', GetPlayerServerId(player))
            end
        else
            TriggerEvent(Utils.eventsPrefix .. ':actions:' .. action, extraData)
        end    
    end,
    function(data, menu)
        menu.close()
    end)
end

Last updated