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.
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
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
Next, navigate to modules/weapon/client.lua and find the following line of code: