Guides
All Events and Exports for msk_handcuffs
You need msk_core! - Download it here
General edits in jobs
Do NOT use this if you use jobs_creator
!
Use this Guide: Jaksam Job Creator
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.
{icon = "fas fa-idkyet", title = 'Handcuff', value = 'handcuff'},
{icon = "fas fa-idkyet", title = 'Hardcuff', value = 'hardcuff'},
{icon = "fas fa-idkyet", title = 'Uncuff', value = 'uncuff'},
{icon = "fas fa-idkyet", title = 'Headbag', value = 'headbag'},
{icon = "fas fa-idkyet", title = 'Ankletracker', value = 'ankletracker'},
{icon = "fas fa-idkyet", title = 'Drag/Escort', value = 'drag'},
{icon = "fas fa-idkyet", title = TranslateCap('put_in_vehicle'), value = 'put_in_vehicle'},
{icon = "fas fa-idkyet", title = TranslateCap('out_the_vehicle'), value = 'out_the_vehicle'},
ESX.OpenContext("right", elements2, function(menu2,element2)
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
if closestPlayer ~= -1 and closestDistance <= 3.0 then
local data2 = {current = element2}
local action = data2.current.value
if action == 'identity_card' then
OpenIdentityCardMenu(closestPlayer)
elseif action == 'search' then
OpenBodySearchMenu(closestPlayer)
elseif action == 'handcuff' then
exports.msk_handcuffs:cuffPlayer('cuffs', closestPlayer)
elseif action == 'hardcuff' then
exports.msk_handcuffs:hardcuffPlayer('hardcuff', closestPlayer)
elseif action == 'uncuff' then
exports.msk_handcuffs:uncuffPlayer('cuff_keys', closestPlayer)
elseif action == 'headbag' then
exports.msk_handcuffs:headbagPlayer(closestPlayer)
elseif action == 'ankletracker' then
exports.msk_handcuffs:ankleTrackerPlayer(closestPlayer)
elseif action == 'drag' then
TriggerServerEvent('msk_handcuffs:setDrag', GetPlayerServerId(closestPlayer))
elseif action == 'put_in_vehicle' then
TriggerServerEvent('msk_handcuffs:putInCar', GetPlayerServerId(closestPlayer))
elseif action == 'out_the_vehicle' then
TriggerServerEvent('msk_handcuffs:outOfCar', GetPlayerServerId(closestPlayer))
elseif action == 'fine' then
OpenFineMenu(closestPlayer)
elseif action == 'license' then
ShowPlayerLicense(closestPlayer)
elseif action == 'unpaid_bills' then
OpenUnpaidBillsMenu(closestPlayer)
end
else
ESX.ShowNotification(TranslateCap('no_players_nearby'))
end
end, function(menu)
OpenPoliceActionsMenu()
end)
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... :(
Edit Menu Options
client/actions/actions.lua
{condition = JobsCreator.activeActions.canHandcuff, label = getLocalizedText('actions_put_handcuffs'), value = 'cuff', type = 'player'},
{condition = JobsCreator.activeActions.canHandcuff, label = getLocalizedText('actions_put_hardcuffs'), value = 'hardcuff', type = 'player'},
{condition = JobsCreator.activeActions.canHandcuff, label = getLocalizedText('actions_take_handcuffs'), value = 'uncuff', type = 'player'},
{condition = JobsCreator.activeActions.canHandcuff, label = getLocalizedText('actions_headbag'), value = 'headbag', type = 'player'},
{condition = JobsCreator.activeActions.canHandcuff, label = getLocalizedText('actions_ankletracker'), value = 'ankletracker', 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'},
Replace isHandcuffed function
if (exports['msk_handcuffs']:getIsHandcuffed()) then
notifyClient(getLocalizedText("you_cant_while_handcuffed"))
return
end
Edit Menu Actions
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
local playerJob = ESX.GetPlayerData().job.name or 'unemployed'
-- Default Options for every Player and Job
local defaultItems = {
cuffItem = 'cable_ties',
hardcuffItem = 'hardcuff',
uncuffItem = 'scissors',
enableHeadbag = true,
enableAnkletracker = false,
}
-- Specific Options for Jobs
local jobs = {
['police'] = {
cuffItem = 'cuffs',
hardcuffItem = 'hardcuff',
uncuffItem = 'cuff_keys',
enableHeadbag = true,
enableAnkletracker = true,
},
['doj'] = {
cuffItem = 'cuffs',
hardcuffItem = 'hardcuff',
uncuffItem = 'cuff_keys',
enableHeadbag = true,
enableAnkletracker = true,
},
}
if action == 'cuff' then
exports.msk_handcuffs:cuffPlayer(jobs[playerJob] and jobs[playerJob].cuffItem or defaultItems.cuffItem)
elseif action == 'hardcuff' then
exports.msk_handcuffs:hardcuffPlayer(jobs[playerJob] and jobs[playerJob].hardcuffItem or defaultItems.hardcuffItem)
elseif action == 'uncuff' then
exports.msk_handcuffs:uncuffPlayer(jobs[playerJob] and jobs[playerJob].uncuffItem or defaultItems.uncuffItem)
elseif action == 'ankletracker' then
if jobs[playerJob] and jobs[playerJob].enableAnkletracker then
exports.msk_handcuffs:ankleTrackerPlayer()
else
-- Add your Notification that the Player is not allowed to do that!
end
elseif action == 'headbag' then
if jobs[playerJob] and jobs[playerJob].enableHeadbag then
exports.msk_handcuffs:headbagPlayer()
else
-- Add your Notification that the Player is not allowed to do that!
end
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