TTT Crowbar model replacements in Pointshop

Hello, I saw an old post with a way to set different models to buy in the pointshop so that every time a user spawns back in there crowbar gets replaced with the model of the weapon. I was wondering if there was a way of doing it without re-coding the crowbar weapon file and what the code would be to add it into pointshop.
Thanks
(Sorry for my bad english)

EDIT: I was able to find a working code, but sometimes at random when holding a different gun it will basically switch over to the crowbar (like pressing 1)
If anyone knows a fix let me know :slight_smile:
Thx

Hey KpJ if you let me see your code I can help you with the switching error.

the code looks like this:


ITEM.Name = 'Axe' 
ITEM.Price = 600 
ITEM.Model = 'models/weapons/w_axe.mdl' 
ITEM.SingleUse = false 
ITEM.WeaponClass = 'weapon_ttt_axe'

function ITEM:OnEquip(ply)
ply:StripWeapon('weapon_zm_improvised')
	ply:Give(self.WeaponClass)
	ply:SelectWeapon(self.WeaponClass)
end

function ITEM:OnHolster(ply)
	ply:StripWeapon(self.WeaponClass)
	ply:Give('weapon_zm_improvised')
	ply:SelectWeapon('weapon_zm_improvised')
end

function ITEM:PlayerSpawn(ply)
        ply:StripWeapon('weapon_zm_improvised')
	ply:Give(self.WeaponClass)
        ply:SelectWeapon(self.WeaponClass)
end


Thanks!

-snip-
dont read mha shit

You don’t need the function ITEM:PlayerSpawn(ply) function.
Your code should look something like this:
[LUA]ITEM.Name = ‘Axe’
ITEM.Price = 600
ITEM.Model = ‘models/weapons/w_axe.mdl’
ITEM.SingleUse = false
ITEM.WeaponClass = ‘weapon_ttt_axe’

function ITEM:OnEquip(ply)
ply:StripWeapon(‘weapon_zm_improvised’)
ply:Give(self.WeaponClass)
ply:SelectWeapon(self.WeaponClass)
end

function ITEM:OnHolster(ply)
ply:StripWeapon(self.WeaponClass)
ply:Give(‘weapon_zm_improvised’)
ply:SelectWeapon(‘weapon_zm_improvised’)
end[/LUA]
Having that function make spectators spawn with it if they open the pointshop (while in spectator) and may cause other glitches that I am unaware of.
Someone shared around that code you’re using which doesn’t work as it should.

Would it be possible to make this check for a weapon before it strips it and gives it. Like if you could purchase an upgrade for the knife.

I understand this would probably have to be bought every time and that is ok with me.


if ply:HasWeapon( "weapon_ttt_knife" ) then

found it myself