Skip to content

Commit

Permalink
Merge pull request #362 from Taxin2012/patch-9
Browse files Browse the repository at this point in the history
Fix SetRestricted() not restoring weapon item and clip ammo
  • Loading branch information
alexgrist authored Oct 10, 2024
2 parents 65ff4de + 2a0dc25 commit a0ae16e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions gamemode/core/meta/sh_player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,12 @@ if (SERVER) then
self.ixRestrictWeps = self.ixRestrictWeps or {}

for _, v in ipairs(self:GetWeapons()) do
self.ixRestrictWeps[#self.ixRestrictWeps + 1] = v:GetClass()
self.ixRestrictWeps[#self.ixRestrictWeps + 1] = {
class = v:GetClass(),
item = v.ixItem,
clip = v:Clip1()
}

v:Remove()
end

Expand All @@ -370,7 +375,13 @@ if (SERVER) then

if (self.ixRestrictWeps) then
for _, v in ipairs(self.ixRestrictWeps) do
self:Give(v)
local weapon = self:Give(v.class, true)

if (v.item) then
weapon.ixItem = v.item
end

weapon:SetClip1(v.clip)
end

self.ixRestrictWeps = nil
Expand Down

0 comments on commit a0ae16e

Please sign in to comment.