Skip to content

Commit

Permalink
fix(client): don't override durability when updating currentWeapon
Browse files Browse the repository at this point in the history
Need to improve ammo/durability updates when rapidly toggling fire.
Resolves #1270.
  • Loading branch information
thelindat committed Apr 17, 2023
1 parent 1d2821e commit 5b95863
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -920,8 +920,9 @@ RegisterNetEvent('ox_inventory:updateSlots', function(items, weights, count, rem
if currentWeapon?.slot == item?.slot and item.metadata then
-- Potential race condition w/ poor connection may lead to ammo/durability values
-- getting desynced or updated out-of-order?
---@todo look into updating ammo handling
item.metadata.ammo = currentWeapon.metadata.ammo
item.metadata.durability = currentWeapon.metadata.durability
-- item.metadata.durability = currentWeapon.metadata.durability
currentWeapon.metadata = item.metadata
TriggerEvent('ox_inventory:currentWeapon', currentWeapon)
end
Expand Down

0 comments on commit 5b95863

Please sign in to comment.