This script, is similar to esx_addoninventory but stores overall data, rather than inventory specific data.
Usage
There is two types of datastores: shared and not shared.
Shared datastores doesn’t belong to a specific user. Example: police armory
None-shared datastores are created for every user in the server. They are created in db when player is loaded, Example: esx_property outfits.
Database Information
A datastore must be configured in the database before using it. you must run a server restart after this.
Table Structure
name
type: string
description: name of the datastore
label
type: string
description: label of the datastore (not used)
shared
type: boolean
description: is the datastore shared with others? (boolean either 0 or 1)
API
getInventory
Event: esx_datastore:getDataStore
Usage: TriggerEvent('esx_datastore:getDataStore', name, owner, function)
Example:
getSharedInventoryTriggerEvent('esx_datastore:getDataStore', 'property', 'steam:0123456789', function(store)
local dressing = store.get('dressing') or {}
end)
Event: esx_datastore:getSharedDataStore
Usage: TriggerEvent('esx_datastore:getSharedDataStore', name, function)
Example:
TriggerEvent('esx_datastore:getSharedDataStore', 'police', function(store)
local weapons = store.get('weapons') or {}
table.insert(weapons, {name = 'WEAPON_PUMPSHOTGUN', ammo = 50})
store.set('weapons', weapons)
end)

