[Release] [ESX] Loot the dead body

I buy a script to loot the body dead :slight_smile:

guys remember fixed or update “extended” for fix dupliacte items

I could adapt what is openinventory with animation + something comes in, as I told you

  1. Update the “extended” to fix the items that are duplicated.

  2. Install Inventoryhud 2.3

Then put what I put up. And it should work.

what do you mean by “update the extended” ?


I do not remember very well. I fixed or made fixed but there I leave the links for you to read and do.

can u share this loot anim?

first install [RELEASE] Progress Bars 1.0 [STANDALONE]
find " OpenBodySearchMenu(closestPlayer)"

and before paste this code

exports[‘progressBars’]:startUI(3100, “Buscando Objetos”)
Citizen.Wait(3000)

I should keep something like that.

exports['progressBars']:startUI(3100, "Buscando Objetos")		
				Citizen.Wait(3000)
OpenBodySearchMenu(closestPlayer)

animation name is anim@heists@money_grab@duffel loop

2 Likes

Thanks

Dose it work?

when i search body the weapon wont show in inventory. can you please tell how to fix it?

esx_inventoryhud/client/main.lua
esx_inventoryhud/client/player.lua

have fix here.

1 Like

thanks you !

Everytime i press E on a dead body. This is my code:

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
}

ESX                           = nil

local PlayerData = {}

Citizen.CreateThread(function()
	while ESX == nil do
		TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
		Citizen.Wait(0)
	end

	while ESX.GetPlayerData().job == nil do
		Citizen.Wait(10)
	end

	PlayerData = ESX.GetPlayerData()
end)

Citizen.CreateThread(function()
	while true do

		Citizen.Wait(0)
		if IsControlJustReleased(0, Keys['E']) then
            local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
            if IsPlayerDead(closestPlayer) then 
                if closestPlayer ~= -1 and closestDistance <= 3.0 then
                    OpenBodySearchMenu(closestPlayer)
                end
            end
		end
	end
end)


function OpenBodySearchMenu(player)

	ESX.TriggerServerCallback('esx_policejob:getOtherPlayerData', function(data)

		local elements = {}

		for i=1, #data.accounts, 1 do

			if data.accounts[i].name == 'black_money' and data.accounts[i].money > 0 then

				table.insert(elements, {
					label    = _U('confiscate_dirty', ESX.Math.Round(data.accounts[i].money)),
					value    = 'black_money',
					itemType = 'item_account',
					amount   = data.accounts[i].money
				})

				break
			end

		end

		table.insert(elements, {label = _U('guns_label'), value = nil})

		for i=1, #data.weapons, 1 do
			table.insert(elements, {
				label    = _U('confiscate_weapon', ESX.GetWeaponLabel(data.weapons[i].name), data.weapons[i].ammo),
				value    = data.weapons[i].name,
				itemType = 'item_weapon',
				amount   = data.weapons[i].ammo
			})
		end

		table.insert(elements, {label = _U('inventory_label'), value = nil})

		for i=1, #data.inventory, 1 do
			if data.inventory[i].count > 0 then
				table.insert(elements, {
					label    = _U('confiscate_inv', data.inventory[i].count, data.inventory[i].label),
					value    = data.inventory[i].name,
					itemType = 'item_standard',
					amount   = data.inventory[i].count
				})
			end
		end

		ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'body_search',
		{
			title    = _U('search'),
			align    = 'top-left',
			elements = elements,
		},
		function(data, menu)

			local itemType = data.current.itemType
			local itemName = data.current.value
			local amount   = data.current.amount

			if data.current.value ~= nil then
				TriggerServerEvent('esx_policejob:confiscatePlayerItem', GetPlayerServerId(player), itemType, itemName, amount)
				OpenBodySearchMenu(player)
			end

		end, function(data, menu)
			menu.close()
		end)

	end, GetPlayerServerId(player))

end

Help!, Thanks

here is a fixed language version

Well, i’ve fixed it momentarelly (wtf) with some random code i’ve found on the forums. it works, it do the work, but…well, you need to disable the OpenBodySearchMenu function from the Policejob lua (dont worry, it’s on this post above somewhere)

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
}







ESX                           = nil

local PlayerData = {}

--function playAnim(animDict, animName, duration)
--	RequestAnimDict(animDict)
	--while not HasAnimDictLoaded(animDict) do Citizen.Wait(0) end
	--TaskPlayAnim(PlayerPedId(), animDict, animName, 1.0, -1.0, duration, 49, 1, false, false, false)
	--RemoveAnimDict(animDict)
--end









Citizen.CreateThread(function()
	while ESX == nil do
		TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
		Citizen.Wait(0)
	end

	while ESX.GetPlayerData().job == nil do
		Citizen.Wait(10)
	end

	PlayerData = ESX.GetPlayerData()
end)

Citizen.CreateThread(function()
	while true do

		Citizen.Wait(0)
		if IsControlJustReleased(0, Keys['E']) then
	
            local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
			
            if IsPlayerDead(closestPlayer) then 
                if closestPlayer ~= -1 and closestDistance <= 1 then
					exports['progressBars']:startUI(3100, "Buscando Objetos")
					Citizen.Wait(3000)
					--playAnim('anim@heists@money_grab@duffel', 'loop',8000) 
                    OpenBodySearchMenu(closestPlayer) 

				else
						closeInventory()
                end
            end
		end
	end
end)


function OpenBodySearchMenu(player)
	TriggerEvent("esx_inventoryhud:openPlayerInventory", GetPlayerServerId(player), GetPlayerName(player))
end

function closeInventory()
    isInInventory = false
    SendNUIMessage(
        {
            action = "hide"
        }
    )
    SetNuiFocus(false, false)
end

RegisterNUICallback(
    "NUIFocusOff",
    function()
        closeInventory()
    end
)

enjoy <3

1 Like

https://github.com/ESX-Org/es_extended/pull/322 here is fix for duplicate items.

that exactly, I referred to that the policejob confiscate code does not work and that the inventoryhud 2.3 can easily be adapted.

sorry for my bad english

I have an idea of ​​how to adapt or clone the “openinventory” code so that only normal things can be stolen from the body and not the person’s weapons.

that would be great, I’m looking for something like that too.

is this code pasted into esx_lootDeadbody’s client ???

u have fix extended for duplicate items?

hi bro. weapon duplicate problem still continues. policejob and esx_lootdeadbody for im using inventoryhud.

how to solve weapon duplicate problem ? please help me :frowning: I’ve been searching for 1 week

1 Like

this fix is for see weapon in inventory player

2 Likes