jaksam_inventory/_hooks folder.
Best Practices
Use filters
Always use appropriate filters to avoid unnecessary hook executions
Early returns
Use early returns to exit hooks when conditions aren’t met
Performance
Keep hook logic lightweight to avoid impacting inventory performance
Use Case Examples
- Prevent players from stealing items that have the
sole_ownermetadata field (e.g., VIP items) - Prevent players from moving police weapons into their personal inventory
- Allow only one backpack per player inventory
- Crafting items by dragging a specific item over another item (for example dragging bread on meat can make a sandwich)
- Block item usage when player is handcuffed or in specific zones
- Track item usage statistics and achievements
- Prevent using certain items while in vehicles
- Add starter items to new player inventories when they are created
- Pre-populate dumpsters or stashes with random items on creation
API Functions
Register a Hook
Parameters
Return value
Unregister a Hook
Parameters
Unregister All Resource Hooks
Parameters
Options Parameter
The options parameter accepts a table with filters to optimize performance.- Common (all events)
- Inventory filters
- Transfer filters
Available Hook Events
Hook Behavior
Priority
Higher numbers execute first (default: 0)
Return values
return nil or return true: allow the action to continue.return false, "message", "notifyType": prevents the action and stops further hook execution. The message and notifyType parameters are optional (notifyType can be "error", "success", "info")