UpdatePlate added for all bridged inventories
This commit is contained in:
1 parent
1399b2e754
commit
17d68505a6
5 files changed
+60
No files matched your search
@@ -23,3 +23,15 @@ Inventory.GetItemBySlot = function(src, slot)
|
|||||||
if not slotData then return {} end
|
if not slotData then return {} end
|
||||||
return { name = slotData.name, label = slotData.label, weight = slotData.weight, slot = slot, count = slotData.amount, metadata = slotData.info, stack = slotData.unique, description = slotData.description }
|
return { name = slotData.name, label = slotData.label, weight = slotData.weight, slot = slot, count = slotData.amount, metadata = slotData.info, stack = slotData.unique, description = slotData.description }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Inventory.UpdatePlate = function(oldplate, newplate)
|
||||||
|
local queries = {
|
||||||
|
'UPDATE gloveboxitems SET plate = @newplate WHERE plate = @oldplate',
|
||||||
|
'UPDATE trunkitems SET plate = @newplate WHERE plate = @oldplate',
|
||||||
|
}
|
||||||
|
local values = { newplate = newplate, oldplate = oldplate }
|
||||||
|
MySQL.transaction.await(queries, values)
|
||||||
|
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||||
|
exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||||
|
return true
|
||||||
|
end
|
||||||
@@ -99,3 +99,15 @@ Inventory.GetImagePath = function(item)
|
|||||||
local imagePath = file and string.format("nui://origen_inventory/html/images/%s.png", item)
|
local imagePath = file and string.format("nui://origen_inventory/html/images/%s.png", item)
|
||||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Inventory.UpdatePlate = function(oldplate, newplate)
|
||||||
|
local queries = {
|
||||||
|
'UPDATE gloveboxitems SET plate = @newplate WHERE plate = @oldplate',
|
||||||
|
'UPDATE trunkitems SET plate = @newplate WHERE plate = @oldplate',
|
||||||
|
}
|
||||||
|
local values = { newplate = newplate, oldplate = oldplate }
|
||||||
|
MySQL.transaction.await(queries, values)
|
||||||
|
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||||
|
exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||||
|
return true
|
||||||
|
end
|
||||||
@@ -35,3 +35,15 @@ Inventory.RemoveItem = function(src, item, amount, slot, metadata)
|
|||||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata})
|
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata})
|
||||||
return exports['ps-inventory']:RemoveItem(src, item, amount, slot, 'community_bridge')
|
return exports['ps-inventory']:RemoveItem(src, item, amount, slot, 'community_bridge')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Inventory.UpdatePlate = function(oldplate, newplate)
|
||||||
|
local queries = {
|
||||||
|
'UPDATE gloveboxitems SET plate = @newplate WHERE plate = @oldplate',
|
||||||
|
'UPDATE trunkitems SET plate = @newplate WHERE plate = @oldplate',
|
||||||
|
}
|
||||||
|
local values = { newplate = newplate, oldplate = oldplate }
|
||||||
|
MySQL.transaction.await(queries, values)
|
||||||
|
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||||
|
exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||||
|
return true
|
||||||
|
end
|
||||||
@@ -88,3 +88,15 @@ Inventory.GetImagePath = function(item)
|
|||||||
local imagePath = file and string.format("nui://qs-inventory/html/images/%s.png", item)
|
local imagePath = file and string.format("nui://qs-inventory/html/images/%s.png", item)
|
||||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Inventory.UpdatePlate = function(oldplate, newplate)
|
||||||
|
local queries = {
|
||||||
|
'UPDATE inventory_trunk SET plate = @newplate WHERE plate = @oldplate',
|
||||||
|
'UPDATE inventory_glovebox SET plate = @newplate WHERE plate = @oldplate',
|
||||||
|
}
|
||||||
|
local values = { newplate = newplate, oldplate = oldplate }
|
||||||
|
MySQL.transaction.await(queries, values)
|
||||||
|
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||||
|
exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||||
|
return true
|
||||||
|
end
|
||||||
@@ -76,3 +76,15 @@ Inventory.GetImagePath = function(item)
|
|||||||
local imagePath = pngPath and string.format("nui://inventory_images/html/images/%s.png", item) or webpPath and string.format("nui://inventory_images/html/images/%s.webp", item)
|
local imagePath = pngPath and string.format("nui://inventory_images/html/images/%s.png", item) or webpPath and string.format("nui://inventory_images/html/images/%s.webp", item)
|
||||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Inventory.UpdatePlate = function(oldplate, newplate)
|
||||||
|
local queries = {
|
||||||
|
'UPDATE tgiann_inventory_trunkitems SET plate = @newplate WHERE plate = @oldplate',
|
||||||
|
'UPDATE tgiann_inventory_gloveboxitems SET plate = @newplate WHERE plate = @oldplate',
|
||||||
|
}
|
||||||
|
local values = { newplate = newplate, oldplate = oldplate }
|
||||||
|
MySQL.transaction.await(queries, values)
|
||||||
|
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||||
|
exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||||
|
return true
|
||||||
|
end
|
||||||
Reference in new issue
Block a user