# FX-Stash&#x20;

#### NEW VORP INVENTORY

vorp\_inventory/server/services/inventoryApiService.lua

**Replace Function**

```lua
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

<mark style="color:green;">**STEP - 1**</mark>

*Add the following codes to the specified .lua file*

#### `vorp_inventory/client/controllers/NUIController.lua`

***Add the code below***

```lua
-- 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)
```

<mark style="color:green;">**STEP - 2**</mark>

*Add the following codes to the specified .lua file*

#### `vorp_inventory/client/services/NUIService.lua`

*Add the code below after line 311*

```lua
------------------------ 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
------------------------------------------------------------
```

```lua
  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
```

<mark style="color:green;">**STEP - 3**</mark>

*Change the below mentioned codes*

**`vorp_inventory/html/js/secondaryInvScript.js`**

* Replace const ActionTakeList

```js
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**

```js
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" },
};
```

\ <mark style="color:green;">**STEP - 4**</mark>

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

**`vorp_inventory/html/js/script.js`**

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

<mark style="color:green;">**STEP - 5**</mark>

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

#### `vorp_inventory/html/js/data.js`

```js
  let stashid = 0;
```

Congratulations, you can now create stashes  <img src="https://2395365523-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxOZaSuLEKsGtkVmLfzPm%2Fuploads%2FLZRLYmG58oi9sgFsOXtu%2Fredm.png?alt=media&#x26;token=02edbe2e-6f18-4a16-ac86-4ccfc139d6dd" alt="" data-size="line">
