mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-09-04 16:23:21 +00:00
Remove table.insert
This commit is contained in:
+4
-4
@@ -419,7 +419,7 @@ function QBCore.Player.CreatePlayer(PlayerData)
|
||||
local slots = QBCore.Player.GetSlotsByItem(self.PlayerData.items, item)
|
||||
for _, slot in pairs(slots) do
|
||||
if slot then
|
||||
table.insert(items, self.PlayerData.items[slot])
|
||||
items[#items+1] = self.PlayerData.items[slot]
|
||||
end
|
||||
end
|
||||
return items
|
||||
@@ -569,13 +569,13 @@ QBCore.Player.SaveInventory = function(source)
|
||||
if items and next(items) then
|
||||
for slot, item in pairs(items) do
|
||||
if items[slot] then
|
||||
table.insert(ItemsJson, {
|
||||
ItemsJson[#ItemsJson+1] = {
|
||||
name = item.name,
|
||||
amount = item.amount,
|
||||
info = item.info,
|
||||
type = item.type,
|
||||
slot = slot,
|
||||
})
|
||||
}
|
||||
end
|
||||
end
|
||||
exports.oxmysql:execute('UPDATE players SET inventory = ? WHERE citizenid = ?', { json.encode(ItemsJson), PlayerData.citizenid })
|
||||
@@ -602,7 +602,7 @@ function QBCore.Player.GetSlotsByItem(items, itemName)
|
||||
if items then
|
||||
for slot, item in pairs(items) do
|
||||
if item.name:lower() == itemName:lower() then
|
||||
table.insert(slotsFound, slot)
|
||||
slotsFound[#slotsFound+1] = slot
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user