Skip to content

Commit

Permalink
weaponchecker: Fixed error when player already owns weapon upon retur…
Browse files Browse the repository at this point in the history
…ning

Fixes #2866
  • Loading branch information
FPtje committed Apr 8, 2019
1 parent 5210104 commit 1e6f9a1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions entities/weapons/weaponchecker/shared.lua
Expand Up @@ -221,6 +221,11 @@ function SWEP:Reload()
else
for _, v in pairs(ent.ConfiscatedWeapons) do
local wep = ent:Give(v.class)

-- :Give returns NULL when the player already has the weapon
wep = IsValid(wep) and wep or ent:GetWeapon(v.class)
if not IsValid(wep) then continue end

ent:RemoveAllAmmo()
ent:SetAmmo(v.primaryAmmoCount, v.primaryAmmoType, false)
ent:SetAmmo(v.secondaryAmmoCount, v.secondaryAmmoType, false)
Expand Down

0 comments on commit 1e6f9a1

Please sign in to comment.