OX_Inventory Integration

Find information on configuring for OX_Inventory!

Integrating Smart Hose with OX_Inventory requires a moderate amount of code editing in the OX_Inventory resource, but we've explained it all below for you to follow.

  1. Begin by navigating to modules/items/server.lua within the OX_Inventory resource, finding the following lines of code:

if item.hash == `WEAPON_PETROLCAN` or item.hash == `WEAPON_HAZARDCAN` or item.hash == `WEAPON_FERTILIZERCAN` or item.hash == `WEAPON_FIREEXTINGUISHER` then
            metadata.ammo = metadata.durability
end

Replace the three lines of code with the following code block:

if item.hash == `WEAPON_PETROLCAN` or item.hash == `WEAPON_HAZARDCAN` or item.hash == `WEAPON_FERTILIZERCAN` or item.hash == `WEAPON_FIREEXTINGUISHER` then
        metadata.ammo = metadata.durability
    elseif item.hash == `WEAPON_HOSE` then
            metadata.ammo = 9999
end

  1. Next, navigate to modules/inventory/server.lua and find the following lines of code:

if item.hash == `WEAPON_FIREEXTINGUISHER` or item.hash == `WEAPON_PETROLCAN` or item.hash == `WEAPON_HAZARDCAN` or item.hash == `WEAPON_FERTILIZERCAN` then
        weapon.metadata.durability = math.floor(value)
                    weapon.metadata.ammo = weapon.metadata.durability
                elseif value < weapon.metadata.ammo then
                    local durability = Items(weapon.name).durability * math.abs((weapon.metadata.ammo or 0.1) - value)
                    weapon.metadata.ammo = value
                    weapon.metadata.durability = weapon.metadata.durability - durability
                    weapon.weight = Inventory.SlotWeight(item, weapon)
end

Replace the lines of code with the following code block:

if item.hash == `WEAPON_FIREEXTINGUISHER` or item.hash == `WEAPON_PETROLCAN` or item.hash == `WEAPON_HAZARDCAN` or item.hash == `WEAPON_FERTILIZERCAN` then
                    weapon.metadata.durability = math.floor(value)
                    weapon.metadata.ammo = weapon.metadata.durability
                elseif item.hash == `WEAPON_HOSE` then
                    weapon.metadata.ammo = 99999
                elseif value < weapon.metadata.ammo then
                    local durability = Items(weapon.name).durability * math.abs((weapon.metadata.ammo or 0.1) - value)
                    weapon.metadata.ammo = value
                    weapon.metadata.durability = weapon.metadata.durability - durability
                    weapon.weight = Inventory.SlotWeight(item, weapon)
                end

  1. Next, navigate to modules/weapon/client.lua and find the following line of code:

GiveWeaponToPed(playerPed, data.hash, 0, false, true)

Replace the line of code with the following code block:

GiveWeaponToPed(playerPed, data.hash, 0, false, true)
if data.hash == `WEAPON_HOSE` then
        TriggerServerEvent("Server:HoseCommand")
end

  1. Next, stay in modules/weapon/client.lua and find the following lines of code:

TriggerServerEvent('ox_inventory:updateWeapon')

Replace the lines of code with the following code block:

TriggerServerEvent('ox_inventory:updateWeapon')
if currentWeapon.hash == `WEAPON_HOSE` then
        TriggerServerEvent("Server:HoseCommand")
end

  1. Next, navigate to data/weapons.lua and add the following lines of code to the table:

['WEAPON_HOSE'] = {
            label = 'Hose',
            weight = 1000,
},

  1. Next, head to the config.lua file of the Smart Hose resource. Find line 5 and enable OX_Inventory. You can also set the item name a few lines below.

oxInventory = false,

Last updated