Improvement of the GetInventory
function for offline player management and new inventory search features
#1787
Labels
enhancement
New feature or request
I propose an enhancement to the
ox_inventory:GetInventory
function so that it works correctly when attempting to retrieve the inventory of an offline player using theircitizenid
. Currently, the function does not seem to return the inventory as expected in this scenario, limiting the ability to manage critical items (such as keys) for disconnected players. Additionally, I would like to suggest adding a new feature that allows searching for specific items across all existing inventory types.Identified Issues:
Retrieving inventory for offline players:
Currently, the
ox_inventory:GetInventory
function does not allow retrieving the inventory of an offline player via theircitizenid
, which prevents access to specific items such as rental keys when the player is not connected. This limitation complicates resource and interaction management in the game, especially in contexts where a player’s offline status should not be a hindrance.Global item search:
There is currently no simple way to search for a specific item across all inventories, whether they are player inventories (online or offline), vehicle trunks, job stashes, or even temporary containers. This makes it challenging to manage items globally on the server.
Problematic Example Code for Inventory Retrieval:
Proper Functioning of
getInventorykeyRent
:Note that the
getInventorykeyRent
function works correctly for online players:Proposed Enhancements:
Offline Inventory Retrieval:
I suggest that the
ox_inventory:GetInventory
function be improved to support the retrieval of offline player inventories using theircitizenid
. This could include:GetInventory
should be able to automatically load the inventory from the database or another persistent source.Global Item Search:
I also propose adding a new feature that allows searching for specific items across all existing inventory types (players, stashes, vehicles, etc.). Here’s an idea of the function to be added:
Expected Benefits:
Simplified management of offline items: Allows for the retrieval, management, and manipulation of items for offline players in a transparent manner.
Improved server functionality: Facilitates the management of critical resources (such as keys) that could otherwise remain inaccessible when players are offline.
Easier global search: Allows administrators and scripts to perform quick and efficient searches across all available inventories on the server.
Gameplay continuity: This functionality ensures continuity in gameplay and inventory systems, avoiding interruptions due to technical limitations.
I hope this suggestion will be considered to improve
ox_inventory
and offer greater flexibility and better inventory management, particularly in scenarios involving offline players or specific item searches.The text was updated successfully, but these errors were encountered: