RegisterNetEvent('disc-inventoryhud:steal') ***<<<<<<<< this is the steal faunction***
AddEventHandler('disc-inventoryhud:steal', function()
local player = ESX.GetPlayerData()
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
if closestPlayer ~= -1 and closestDistance <= 3.0 then
local searchPlayerPed = GetPlayerPed(closestPlayer) <<<<<<<< is it normal that this is called as search, not steal ??
if IsEntityPlayingAnim(searchPlayerPed, 'missminuteman_1ig_2', 'handsup_enter', 3) or IsEntityDead(searchPlayerPed) or GetEntityHealth(searchPlayerPed) <= 0 then <<< same here
ESX.TriggerServerCallback('disc-inventoryhud:getIdentifier', function(identifier)
secondarySearchInventory.owner = identifier <<< and here
openInventory(secondarySearchInventory) <<< here too
end, GetPlayerServerId(closestPlayer))
end
end
end)
RegisterNetEvent('disc-inventoryhud:search')
AddEventHandler('disc-inventoryhud:search', function()
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
if closestPlayer ~= -1 and closestDistance <= 3.0 then
local searchPlayerPed = GetPlayerPed(closestPlayer)
if IsEntityPlayingAnim(searchPlayerPed, 'mp_arresting', 'idle', 3) and not IsPedArmed(closestPlayer,7) then
ESX.TriggerServerCallback('disc-inventoryhud:getIdentifier', function(identifier)
secondaryStealInventory.owner = identifier <<<< and here is steal not search
openInventory(secondaryStealInventory) <<<< here too
end, GetPlayerServerId(closestPlayer))
end
end
end)