A collection of server-side hooks that modify item behavior during inventory transfers within ox_inventory.
Important
This script will work best with v2.47.2 of ox_inventory, as it provides a more reliable method in acting on the item's metadata.
No changes will need to be made to this script, it'll detect if using the appropriate version and act accordingly.
The system is designed to be entirely modular. To remove a hook, simply delete its corresponding file from the server/hooks/ directory. The server will instantly stop integrating it upon the next resource restart.
Fridge Hook: extend an items lifespan
The fridge hook extends the lifespan of degradable items while they are stored in specific containers.
When an item is moved into a "fridge," the script calculates the remaining life and extends the expiration timestamp. To ensure the UI displays the correct percentage, it also scales the degrade metadata. When removed, the process is reversed, returning the item to its original degradation rate.
-
Stash Names: Any stash name containing the keyword
"fridge". -
Tweak
fridgePatterninfridge.lua. -
Durability Multiplier: Controlled by
durabilityIncrease(Default:2). -
Doubles the remaining time before the item rots.
Freezer Hook: freeze an items degradation
The Freezer Hook effectively "pauses" the degradation process entirely.
How it works
Because ox_inventory uses active timestamps for durability, the freezer hook converts the dynamic timestamp into a static percentage value (0–100) and removes the degrade metadata. This stops the "countdown."
-
Entering Freezer: Timestamp
$\rightarrow$ Static Percentage (e.g., 65%). -
Exiting Freezer: Static Percentage
$\rightarrow$ New Expiry Timestamp based on the current time.
Configuration
-
Stash Names: Any stash name containing the keyword
"freezer". - Tweak
freezerPatterninfreezer.lua.
Admin Inventory Hook: limitless item spawning
The Admin Inventory Hook creates a dynamic, secure "sandbox" stash containing every item registered on the server for administrators to pull items from easily.
When an administrator runs the management command, the script dynamically scans the server's shared item list, ignores minor items (like identification), and populates a temporary stash with standard stacks of every available item.
To prevent admins from accidentally making the stash messy or destroying items, the hook explicitly blocks moving items into or swapping items within this specific inventory. It acts strictly as a "take-only" generation point.
- Permissions: Restricted by default to Ace group
group.adminusing thehooks:admininvAce permission node. - Commands: Registered to
/adminitems, can be used with a search parameter to refine the displayed list of items.
identificationitem can not be added, as it will attempt to obtain player data from a stash inventory which will not work
Glovebox access restriction
A hook that prevents players in back seats to open the glovebox, do note that this will stop them from opening the inventory in it's entirety meaning they won't even be able view their inventory and move/use items, they'll only have access to their hotbar.
If you want to simply hide the glovebox inventory, you would need to edit the source code of ox_inventory to allow hiding that second inventory.
When opening the inventory in a vehicle with a glovebox, the openInventory hook will fire the registered callback. This will check if the player is seated in any of the valid seats (by default indices -1 and 0 - driver & front passenger) and only if the player is found will it allow the glovebox to be accessed.
- Seat Overrides: At the top of the file, you can add in overrides for specific models to define what seats can access the glovebox.
- Players can not access their inventory if they can't access the glovebox.
- Fridge: Modifies
durability(timestamp) anddegrade(scale). - Freezer: Converts
durabilityto a float (0.0-100.0), setsdegradetoniland adds aisFrozenboolean flag.