Permanent weapons on pointshop

Does anyone have the code for permanent weapons for point shop. (I’m using the original pointshop here’s the weapon file."


ITEM.Name = 'Diamond Sword'
ITEM.Price = 125000
ITEM.Model = 'models/weapons/w_diamond_mc_sword.mdl'
ITEM.WeaponClass = 'mc_sword_diamond'
ITEM.SingleUse = false

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

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

What would I need to add to make it a permanent weapon where you spawn with it.

ITEM.SingleUse is gawdawful. Try this


ITEM.Name = 'CS:S Knife'
ITEM.Price = 20000
ITEM.Model = 'models/weapons/w_knife_t.mdl'
ITEM.WeaponClass = 'weapon_knife'

function ITEM:OnEquip(ply)
ply:StripWeapon('weapon_knife') -- Remove this if you're not replacing the melee weap
    ply:Give(self.WeaponClass)
    ply:SelectWeapon(self.WeaponClass)
end

function ITEM:OnHolster(ply)
    ply:StripWeapon(self.WeaponClass)
    ply:Give('weapon_knife') -- Remove this if you're not replacing the melee weap
    ply:SelectWeapon('weapon_knife') -- Remove this if you're not replacing the melee weap
end

Note its not mine, got it off another facepunch thread and have used it since.

You already did. “SingleUse = false”. Done, the person just has to buy & equip it.

[editline]29th July 2015[/editline]

Awh cmon why you all post whilst I write?!

SingleUse set to false or nil should do the trick.

norriskirby is right. Essentially you need to swap OnBuy and OnSell to OnEquip and OnHolster for permanent weapons.

Single use doesn’t equip on spawn and it doesn’t even show up on spawn maybe if I removed the freeze time it would work. But some maps need the freeze time. I’m gonna try to use that code.

[editline]29th July 2015[/editline]

Code works. Thanks!:mindblown:

If I have a rainbow shotgun, what should i put in place of “weapon_knife” or do i just delete the whole line?

“weapon_rainbow_shotgun” (but it can be whatever you want it to be)

Thanks everyone! got it to work.