Hi guys im making a custom esx thief from the base, I having problem with dragging, when someone click on “drag” the console give me back that error:
but i don’t understand the error, this is the client code:
function OpenCuffMenu()
local elements = {
{label = _U('cuff'), value = 'cuff'},
{label = _U('uncuff'), value = 'uncuff'},
{label = _U('drag'), value = 'drag'},
{label = _U('search'), value = 'search'},
}
ESX.UI.Menu.CloseAll()
ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'cuffing',
{
title = _U('handcuffs'),
align = 'top-left',
elements = elements
},
function(data2, menu2)
local player, distance = ESX.Game.GetClosestPlayer()
if distance ~= -1 and distance <= 3.0 then
if data2.current.value == 'cuff' then
if Config.EnableItems then
local target_id = GetPlayerServerId(player)
-- IsAbleToSteal(target_id, function(err)
-- if not err then
ESX.TriggerServerCallback('esx_thief:getItemQ', function(quantity)
if quantity >= 0 then
IsAbleToSearch = true
TriggerServerEvent('cuffServer', GetPlayerServerId(player))
else
ESX.ShowNotification(_U('no_handcuffs'))
end
end, 'handcuffs')
-- else
-- ESX.ShowNotification(err)
-- end
-- end)
else
IsAbleToSearch = true
TriggerServerEvent('cuffServer', GetPlayerServerId(player))
end
end
if data2.current.value == 'uncuff' then
if Config.EnableItems then
ESX.TriggerServerCallback('esx_thief:getItemQ', function(quantity)
if quantity >= 0 then
IsAbleToSearch = false
TriggerServerEvent('unCuffServer', GetPlayerServerId(player))
else
ESX.ShowNotification(_U('no_handcuffs'))
end
end, 'handcuffs')
else
IsAbleToSearch = false
TriggerServerEvent('cuffServer', GetPlayerServerId(player))
end
end
if data2.current.value == 'drag' then
if Config.EnableItems then
ESX.TriggerServerCallback('esx_thief:getItemQ', function(quantity)
if quantity >= 0 then
IsAbleToSearch = false
--aaaa
-- TriggerServerEvent('esx_policejob:drag', GetPlayerServerId(closestPlayer))
TriggerServerEvent('dragServer2', GetPlayerServerId(player))
else
ESX.ShowNotification(_U('no_rope'))
end
end, 'rope')
else
TriggerServerEvent('dragServer2', GetPlayerServerId(player))
end
end
if data2.current.value == 'search' then
local player = PlayerPedId()
--line 166: if IsPedArmed(player, 7) then
if IsAbleToSearch then
local target, distance = ESX.Game.GetClosestPlayer()
if target ~= -1 and distance ~= -1 and distance <= 2.0 then
local target_id = GetPlayerServerId(target)
OpenStealMenu(target, target_id)
-- TriggerEvent('animation')
elseif distance < 20 and distance > 2.0 then
ESX.ShowNotification(_U('too_far'))
else
ESX.ShowNotification(_U('no_players_nearby'))
end
else
ESX.ShowNotification(_U('not_cuffed'))
end
else
ESX.ShowNotification(_U('not_armed'))
end
end
else
ESX.ShowNotification(_U('no_players_nearby'))
end
end,
function(data2, menu2)
menu2.close()
end
)
end
and this is the server code
RegisterServerEvent('dragServer2')
AddEventHandler('dragServer2', function(target)
TriggerClientEvent('dragClient2', target, source)
end)
how can i fix it?