Hi,
I have added the following to my item lua file:
function ITEM:OnSell(ply)
ply:StripWeapon(self.WeaponName)
end
however it still wont strip the weapon when a user sells the item, I am doing something wrong?
Because you're stripping the weapon name, which won't work IIRC. You need to use the weapon's class name.
Player/StripWeapon
So for example from the wiki...
player.GetByID( 1 ):StripWeapon( "weapon_crowbar" )
... this uses weapon_crowbar.
So provided your weapon file is the same as on the repo, try this.
function ITEM:OnSell(ply)
ply:StripWeapon(self.WeaponClass)
end
Hmm, I tried that..but seems to not work.
The StripWeapon seem to not work at all. I even tried to add the following:
function ITEM:OnBuy(ply)
ply:Give(self.WeaponClass)
ply:SelectWeapon(self.WeaponClass)
ply:StripWeapon("weapon_crowbar")
end
It gives the weapon without any issue, but does not strip the crow bar.
And same with the the OnSell one wont strip, not even with this:
function ITEM:OnSell(ply)
ply:StripWeapon(self.WeaponClass)
end
Solved the issue
Sorry, you need to Log In to post a reply to this thread.