Skip to content
Merged
Changes from 1 commit
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
8 changes: 7 additions & 1 deletion EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,13 @@ private void OnInternalReloaded(ReloadedWeaponEventArgs ev)
int firearmAmmo = ev.Firearm.MagazineAmmo;
int ammoDrop = -(ClipSize - firearmAmmo - ammoChambered);

int ammoInInventory = ev.Player.Ammo[ammoType.GetItemType()] + firearmAmmo;
ushort playerAmmo = 0;
if (ev.Player.Ammo.TryGetValue(ammoType.GetItemType(), out ushort ammo))
{
playerAmmo = ammo;
}

int ammoInInventory = playerAmmo + firearmAmmo;
Comment thread
TtroubleTT marked this conversation as resolved.
Outdated
if (ammoToGive < ammoInInventory)
{
ev.Firearm.MagazineAmmo = ammoToGive;
Expand Down