fix(datastore): Fix bug when datastore was too big

Needs newest esx_datastore (1.0.1)
This commit is contained in:
Jérémie N'gadi
2017-10-16 13:17:44 +02:00
parent e9e8690557
commit c44abb871d
2 changed files with 27 additions and 11 deletions
+17 -5
View File
@@ -490,19 +490,31 @@ end)
ESX.RegisterServerCallback('esx_property:getPlayerDressing', function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)
local dressing = {}
TriggerEvent('esx_datastore:getDataStore', 'property', xPlayer.identifier, function(store)
local storeDressing = store.get('dressing')
local count = store.count('dressing')
local labels = {}
if storeDressing ~= nil then
dressing = storeDressing
for i=1, count, 1 do
local entry = store.get('dressing', i)
table.insert(labels, entry.label)
end
cb(labels)
end)
cb(dressing)
end)
ESX.RegisterServerCallback('esx_property:getPlayerOutfit', function(source, cb, num)
local xPlayer = ESX.GetPlayerFromId(source)
TriggerEvent('esx_datastore:getDataStore', 'property', xPlayer.identifier, function(store)
local outfit = store.get('dressing', num)
cb(outfit.skin)
end)
end)