Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1511,7 +1511,7 @@ RegisterNetEvent('ox_inventory:setPlayerInventory', function(currentDrops, inven
currentWeapon.metadata.ammo = (weaponAmmo < currentAmmo) and 0 or currentAmmo

if currentAmmo <= 0 then
SetPedInfiniteAmmo(playerPed, false, currentWeapon.hash)
SetPedInfiniteAmmoClip(playerPed, false)
end
else
currentAmmo = GetAmmoInPedWeapon(playerPed, currentWeapon.hash)
Expand Down
6 changes: 5 additions & 1 deletion modules/weapon/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function Weapon.Equip(item, data, noWeaponAnim)

if item.group == `GROUP_PETROLCAN` or item.group == `GROUP_FIREEXTINGUISHER` then
item.metadata.ammo = item.metadata.durability
SetPedInfiniteAmmo(playerPed, true, data.hash)
SetPedInfiniteAmmoClip(playerPed, true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This switch causes an infinite ammo bug, where all subsequent weapons will also have infinite ammo.
An extra clause needs to be added to disable the infinite state.

end

TriggerEvent('ox_inventory:currentWeapon', item)
Expand All @@ -101,6 +101,10 @@ function Weapon.Disarm(currentWeapon, noAnim)
TriggerServerEvent('ox_inventory:updateWeapon')
SetPedAmmo(cache.ped, currentWeapon.hash, 0)

if currentWeapon.group == `GROUP_PETROLCAN` or currentWeapon.group == `GROUP_FIREEXTINGUISHER` then
SetPedInfiniteAmmoClip(cache.ped, false)
end

if client.weaponanims and not noAnim then
if cache.vehicle and vehicleIsCycle(cache.vehicle) then
goto skipAnim
Expand Down