PS1 I would like to change to another knife if I picked up the knife.

It does not change when I pick up the knife



ITEM.Name = 'M9 | ' 
ITEM.Price = 600 
ITEM.Model = 'models/weapons/w_csgo_bayonet.mdl' 
ITEM.SingleUse = false 
ITEM.WeaponClass = 'csgo_bayonet_tiger'

function ITEM:OnEquip(ply)
	if ply:HasWeapon( 'weapon_knife' ) then
		ply:StripWeapon( 'weapon_knife' )
		ply:Give(self.WeaponClass)
		ply:SelectWeapon(self.WeaponClass)
	end
end

function ITEM:OnHolster(ply)
	if ply:HasWeapon( 'csgo_bayonet_tiger' ) then
		   ply:StripWeapon(self.WeaponClass)
		   ply:Give( 'weapon_knife' )
	end
end


“OnEquip” is only called when the item is equipped through the menu. Try adding

GM:PlayerCanPickupWeapon to check if they’re picking up the regular knife and give them the csgo knife instead.

I believe it’d look something like this

[lua]
function ITEM:PlayerCanPickupWeapon(psply, mods, ply, wep)
if (psply == ply and wep:GetClass() == “weapon_knife”) then – if the weapon they are trying to pick up is the regular knife
ply:Give(self.WeaponClass) – give them the csgo knife
wep:Remove() – remove the regular knife they were trying to pick up
return false – don’t give them the regular knife
end
end
[/lua]

actually work thank you!!!