From 5fc2192e03fd0c96e6727216a9428a90106b6ec0 Mon Sep 17 00:00:00 2001 From: Duckerr <54422809+Duckerr@users.noreply.github.com> Date: Mon, 5 Oct 2020 13:28:29 -0700 Subject: [PATCH 1/2] Show loadout of others Update to show the loadouts of others with forcesearch --- invhud/client.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/invhud/client.lua b/invhud/client.lua index 40c76b1..f82a6bf 100644 --- a/invhud/client.lua +++ b/invhud/client.lua @@ -997,6 +997,7 @@ AddEventHandler('invhud:openPlayerInventory', function(target, playerName) targetPlayer = target targetPlayerName = playerName setPlayerInventoryData() + openPlayerInventory() end) refreshPlayerInventory = function() @@ -1155,3 +1156,17 @@ RegisterNUICallback('TakeFromPlayer', function(data, cb) cb('ok') end) + +function openPlayerInventory() + loadPlayerInventory() + isInInventory = true + + SendNUIMessage( + { + action = "display", + type = "player" + } + ) + + SetNuiFocus(true, true) +end \ No newline at end of file From abd73a3c87fed5988eb19b2c1e8b23e2c3a94204 Mon Sep 17 00:00:00 2001 From: Duckerr <54422809+Duckerr@users.noreply.github.com> Date: Mon, 5 Oct 2020 13:31:14 -0700 Subject: [PATCH 2/2] Update server.lua --- invhud/server.lua | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/invhud/server.lua b/invhud/server.lua index 6e247c6..186fc22 100644 --- a/invhud/server.lua +++ b/invhud/server.lua @@ -961,4 +961,22 @@ AddEventHandler('invhud:usedAmmo', function(item) local src = source local xPlayer = ESX.GetPlayerFromId(src) xPlayer.removeInventoryItem(item, 1) -end) \ No newline at end of file +end) + +RegisterCommand( + "openinventory", + function(source, args, rawCommand) + if IsPlayerAceAllowed(source, "inventory.openinventory") then + local target = tonumber(args[1]) + local targetXPlayer = ESX.GetPlayerFromId(target) + + if targetXPlayer ~= nil then + TriggerClientEvent("invhud:openPlayerInventory", source, target, targetXPlayer.name) + else + TriggerClientEvent("chatMessage", source, "^1" .. _U("no_player")) + end + else + TriggerClientEvent("chatMessage", source, "^1" .. _U("no_permissions")) + end + end +) \ No newline at end of file