Pointshop Weapons, giving gun, than getting rid of the one in the slot.

Hi. I have a code that will give you a weapon than when you use it, if you have a gun in that slot it wont give it to you. I want to know how to get rid of the weapon in that slot. Here is my code:


ITEM.Name = 'MAC10'
ITEM.Price = 15
ITEM.Model = 'models/weapons/w_smg_mac10.mdl'
ITEM.WeaponClass = 'weapon_zm_mac10'
ITEM.SingleUse = true

function ITEM:OnBuy(ply)
	ply:Give(self.WeaponClass)
	ply:SelectWeapon(self.WeaponClass)
end

function ITEM:OnSell(ply)
	ply:StripWeapon(self.WeaponClass)
end

Look at this. You should be able to make something simple removes any weapon they might be carrying before it gives the player the new weapon.

This doesn’t work Caratt

[LUA]function ITEM:OnBuy(ply)
for k,v in pairs(ply:GetWeapons())do
if v.Kind == weapons.Get(self.WeaponClass).Kind then
WEPS.DropNotifiedWeapon(ply,v)
end
end
ply:Give(self.WeaponClass)
ply:SelectWeapon(self.WeaponClass)

end[/LUA]

This will search their inventory for a weapon of the same slot and drop it before giving them the SWEP.

That worked, thanks