Page cover image

📦FX-Stash

VORP INVENTORY SETUP

NEW VORP INVENTORY

vorp_inventory/server/services/inventoryApiService.lua

Replace Function

local function canContinue(id)
    if not CustomInventoryInfos[id] then
        return false
    end

    if not CustomInventoryInfos[id]:isPermEnabled() then
        return false
    end

    -- if not jobName and not grade then -- best code block for outsider xd
    --     return false
    -- end
    return true
end

OLD INVENTORY

STEP - 1

Add the following codes to the specified .lua file

vorp_inventory/client/controllers/NUIController.lua

Add the code below

-- Fixitfy Stash Module
RegisterNetEvent("fx-stash:OpenStashInventory")
AddEventHandler("fx-stash:OpenStashInventory", NUIService.OpenStashInventory)
RegisterNetEvent("fx-stash:ReloadStashInventory")
AddEventHandler("fx-stash:ReloadStashInventory", NUIService.ReloadInventory)
RegisterNUICallback('TakeFromStash', NUIService.NUITakeFromStash)
RegisterNUICallback('MoveToStash', NUIService.NUIMoveToStash)

STEP - 2

Add the following codes to the specified .lua file

vorp_inventory/client/services/NUIService.lua

Add the code below after line 311

------------------------ FİXİTFY ------------------------
NUIService.OpenStashInventory = function(stashname, stashid, capacity)
	fixitfyStash = stashname
	SetNuiFocus(true, true)
	SendNUIMessage({
		action = "display",
		type = "stash",
		title = stashname,
		stashid = stashid,
		capacity = capacity,
		search = Config.InventorySearchable
	})
	InInventory = true
end

NUIService.NUIMoveToStash = function(obj)
	TriggerServerEvent("fx-stash:MoveToStash", json.encode(obj))
end

NUIService.NUITakeFromStash = function(obj)
	TriggerServerEvent("fx-stash:TakeFromStash", json.encode(obj))
end
------------------------------------------------------------
  local fixitfyStash = false    -- ADD TO LINE 10
 -- Find And Replace The Following Function
  NUIService.CloseInventory = function()
    if storemenu then
        storemenu = false
        geninfo = {}
        for _, item in pairs(UserInventory) do
            if item.metadata ~= nil and item.metadata.description ~= nil and
                (item.metadata.orgdescription ~= nil or item.metadata.orgdescription == "") then
                if item.metadata.orgdescription == "" then
                    item.metadata.description = nil
                else
                    item.metadata.description = item.metadata.orgdescription
                end
                item.metadata.orgdescription = nil
            end
        end
    end
    if fixitfyStash then
        TriggerServerEvent('fx-stash:closeStash',fixitfyStash)
        fixitfyStash = false
    end
    if not CanOpen then -- only trigger if somone is inside custom inv
        TriggerServerEvent("vorp_inventory:Server:UnlockCustomInv")
    end
    SetNuiFocus(false, false)
    SendNUIMessage({ action = "hide" })
    InInventory = false
    TriggerEvent("vorp_stables:setClosedInv", false)
    TriggerEvent("syn:closeinv")
end
-- Find And Replace The Following Function
NUIService.CloseInv = function()
    if storemenu then
        storemenu = false
        geninfo = {}
        for _, item in pairs(UserInventory) do
            if item.metadata ~= nil and item.metadata.description ~= nil and
                (item.metadata.orgdescription ~= nil or item.metadata.orgdescription == "") then
                if item.metadata.orgdescription == "" then
                    item.metadata.description = nil
                else
                    item.metadata.description = item.metadata.orgdescription
                end
                item.metadata.orgdescription = nil
            end
        end
    end
    if fixitfyStash then
        TriggerServerEvent('fx-stash:closeStash',fixitfyStash)
        fixitfyStash = false
    end
    if not CanOpen then -- only trigger if somone is inside
        TriggerServerEvent("vorp_inventory:Server:UnlockCustomInv")
    end
    SetNuiFocus(false, false)
    SendNUIMessage({ action = "hide" })
    InInventory = false
    TriggerEvent("vorp_stables:setClosedInv", false)
    TriggerEvent("syn:closeinv")
end

STEP - 3

Change the below mentioned codes

vorp_inventory/html/js/secondaryInvScript.js

  • Replace const ActionTakeList

const ActionTakeList = {
  custom: { action: "TakeFromCustom", id: () => customId, customtype: "id" },
  cart: { action: "TakeFromCart", id: () => wagonid, customtype: "wagon" },
  house: { action: "TakeFromHouse", id: () => houseId, customtype: "house" },
  stash: { action: "TakeFromStash", id: () => stashid, customtype: "stash" },
  hideout: {
    action: "TakeFromHideout",
    id: () => hideoutId,
    customtype: "hideout",
  },
  bank: { action: "TakeFromBank", id: () => bankId, customtype: "bank" },
  clan: { action: "TakeFromClan", id: () => clanid, customtype: "clan" },
  steal: { action: "TakeFromsteal", id: () => stealid, customtype: "steal" },
  Container: {
    action: "TakeFromContainer",
    id: () => Containerid,
    customtype: "Container",
  },
  horse: { action: "TakeFromHorse", id: () => horseid, customtype: "horse" },
};

- Replace const ActionMoveList

const ActionMoveList = {
  custom: { action: "MoveToCustom", id: () => customId, customtype: "id" },
  cart: { action: "MoveToCart", id: () => wagonid, customtype: "wagon" },
  house: { action: "MoveToHouse", id: () => houseId, customtype: "house" },
  stash: { action: "MoveToStash", id: () => stashid, customtype: "stash" },
  hideout: {
    action: "MoveToHideout",
    id: () => hideoutId,
    customtype: "hideout",
  },
  bank: { action: "MoveToBank", id: () => bankId, customtype: "bank" },
  clan: { action: "MoveToClan", id: () => clanid, customtype: "clan" },
  steal: { action: "MoveTosteal", id: () => stealid, customtype: "steal" },
  Container: {
    action: "MoveToContainer",
    id: () => Containerid,
    customtype: "Container",
  },
  horse: { action: "MoveToHorse", id: () => horseid, customtype: "horse" },
};

STEP - 4

Add the following code to the specified file. After line 143

vorp_inventory/html/js/script.js

        if (event.data.type == "stash") {
            stashid = event.data.stashid;
            initiateSecondaryInventory(stashid, event.data.title, event.data.capacity)
        }

STEP - 5

Add the following code to the specified file. After line 8

vorp_inventory/html/js/data.js

  let stashid = 0;

Congratulations, you can now create stashes

Last updated