[Release] Handcuff and Handsup scripts


#102

The /cuff doesn’t work… Can I get some help?


#103

It does if installed correctly. I would suggest reinstalling it.

If there’s any server or console errors post them here and it will be fixed…


#104

how could i create script to use key “G” to cuff someone? little help?


#105

It sounds like you need more than a little help… Especially since the script is simple?


#106

im newbie in LUA scripts. i’ve added one script for that but it isn’t working. sorry for my language. I will be greatfull for giving me advise where to start with the code

i created this:

local Keys = {
[“G”] = 47,

function

if(get_key_pressed(Keys.G))then
PLAYER.SET_PLAYER_handcuff(player, true)

elseif action == ‘handcuff’ then

TriggerServerEvent(‘esx_policejob:handcuff’, GetPlayerServerId(closestPlayer))

end

and thats it… i dont know what to do with it or what next


#107

I’ll probably just convert this one. Also… of course that isn’t working there is so much wrong with it…


#108

could you help me what to do?


#109

It will take me longer to help you fix that than for me to just rewrite this one.


#110

what do you mean rewrite this one? mine? or you give me your formula


#111

I’m not gonna give you anything. I am rewriting the resource you commented on. THIS TOPICS CODE. My original resource


#112

thank you… i will back soon and see


#113

how about that:

local Keys = {
[“ESC”] = 322, [“F1”] = 288, [“F2”] = 289, [“F3”] = 170, [“F5”] = 166, [“F6”] = 167, [“F7”] = 168, [“F8”] = 169, [“F9”] = 56, [“F10”] = 57,
["~"] = 243, [“1”] = 157, [“2”] = 158, [“3”] = 160, [“4”] = 164, [“5”] = 165, [“6”] = 159, [“7”] = 161, [“8”] = 162, [“9”] = 163, ["-"] = 84, ["="] = 83, [“BACKSPACE”] = 177,
[“TAB”] = 37, [“Q”] = 44, [“W”] = 32, [“E”] = 38, [“R”] = 45, [“T”] = 245, [“Y”] = 246, [“U”] = 303, [“P”] = 199, ["["] = 39, ["]"] = 40, [“ENTER”] = 18,
[“CAPS”] = 137, [“A”] = 34, [“S”] = 8, [“D”] = 9, [“F”] = 23, [“G”] = 47, [“H”] = 74, [“K”] = 311, [“L”] = 182,
[“LEFTSHIFT”] = 21, [“Z”] = 20, [“X”] = 73, [“C”] = 26, [“V”] = 0, [“B”] = 29, [“N”] = 249, [“M”] = 244, [","] = 82, ["."] = 81,
[“LEFTCTRL”] = 36, [“LEFTALT”] = 19, [“SPACE”] = 22, [“RIGHTCTRL”] = 70,
[“HOME”] = 213, [“PAGEUP”] = 10, [“PAGEDOWN”] = 11, [“DELETE”] = 178,
[“LEFT”] = 174, [“RIGHT”] = 175, [“TOP”] = 27, [“DOWN”] = 173,
[“NENTER”] = 201, [“N4”] = 108, [“N5”] = 60, [“N6”] = 107, [“N+”] = 96, [“N-”] = 97, [“N7”] = 117, [“N8”] = 61, [“N9”] = 118
}

local PlayerData = {}
local HasAlreadyEnteredMarker = false
local LastStation = nil
local LastPart = nil
local LastPartNum = nil
local LastEntity = nil
local CurrentAction = nil
local CurrentActionMsg = ‘’
local CurrentActionData = {}
local IsHandcuffed = false
local HandcuffTimer = {}
local DragStatus = {}
DragStatus.IsDragged = false
local hasAlreadyJoined = false
local blipsCops = {}
local isDead = false
local CurrentTask = {}
local playerInService = false

ESX = nil

ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'police_actions',
{
	title    = 'Police',
	align    = 'top-left',
	elements = {
		{label = _U('citizen_interaction'),	value = 'citizen_interaction'},
		{label = _U('vehicle_interaction'),	value = 'vehicle_interaction'},
		{label = _U('object_spawner'),		value = 'object_spawner'}
	}
}, function(data, menu)

	if data.current.value == 'citizen_interaction' then
		local elements = {
			{label = _U('id_card'),			value = 'identity_card'},
			{label = _U('search'),			value = 'body_search'},
			{label = _U('handcuff'),		value = 'handcuff'},
			{label = _U('drag'),			value = 'drag'},
			{label = _U('put_in_vehicle'),	value = 'put_in_vehicle'},
			{label = _U('out_the_vehicle'),	value = 'out_the_vehicle'},
			{label = _U('fine'),			value = 'fine'},
			{label = _U('unpaid_bills'),	value = 'unpaid_bills'}
		}
	
		if Config.EnableLicenses then
			table.insert(elements, { label = _U('license_check'), value = 'license' })
		end
	
		ESX.UI.Menu.Open(
		'default', GetCurrentResourceName(), 'citizen_interaction',
		{
			title    = _U('citizen_interaction'),
			align    = 'top-left',
			elements = elements
		}, function(data2, menu2)
			local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
			if closestPlayer ~= -1 and closestDistance <= 3.0 then
			if IsControlJustPressed(0, 47) then
			TriggerServerEvent('esx_policejob:handcuff', GetPlayerServerId(closestPlayer))
        end
     end
 end)            
end

end)

its not returning any errors but still not working


#114

I will not help you with ESX. Also stop using the keys table


#115

thank you very much… i’ve managed with that and finished work


#116

How can I make handcuffs that can be used by the keybind?


#117

I’m not gonna take you to a step by step on how to do it.


#118

@xander1998 So I did this on my test server and it worked, put it on my main server and its not working, only thing I can think of something else is outdated, does this script depends on essentialmode or es_extended etc?


#119

No. It doesn’t depend on anything.


#120

Got it, thanks for this amazing script.


#121

C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:41: in field ‘CreateThreadNow’
citizen:/scripting/lua/scheduler.lua:174: in function citizen:/scripting/lua/scheduler.lua:138
this from /cuff