[Pointshop] How i can add new Models for the Crowbar

Hey guys,
i want add other models for the Crowbar in the Pointshop, but important is that,
i want change the weapon sound, too. ( Lightsword with Crowbar sound are stupid :b)


ITEM.Name = 'Sledgehammer'
ITEM.Price = 1500
ITEM.Model = 'models/weapons/w_sledgehammer.mdl'
ITEM.WeaponClass = 'weapon_zm_sledgehammer'

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

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

So i add the new “SWEP weapon”. Over the weapon lua, i hope u understand what i mean.

but i have a kind of bigger problem…
When i bought it and choose for example the katana model.
Sometimes the player switch to the katana without doing something.

I want shoot with my m16 and suddenly while i am shooting the game thinks “HERE take the katana and die!”
that so stupid… i hope someone can edit the code so it dont randomly change.

There is literally nothing wrong with the code you provided, as it happens, I’m using the exact same code on my TTT server and I have never encountered the “issue” you report.
This code cannot be the culprit as it’s only called when you equip/unequip the Pointshopitem in the Pointshop itself. It has nothing to do with weapon switching itself.

To add a Lightsaber you would simply make a copy of weapon_zm_improvised. Rename this new copy to weapon_zm_lightsaber. Open the new file and replace the models inside with the new lightsaber models and the sound file with your lightsaber sound (And edit the name from crowbar to lightsaber). You will need to remove the default spawn line in your lightsaber swep (weapon_zm_lightsaber). Now in the code you provided, replace the weapon_zm_sledgehammer by weapon_zm_lightsaber and replace the mdl by the model of your lightsaber (it’s the model shown in the pointshop).

Like so:


ITEM.Name = 'Lightsaber' 
ITEM.Price = 1500 
ITEM.Model = 'models/weapons/w_lightsaber.mdl' 
ITEM.WeaponClass = 'weapon_zm_lightsaber' 
function ITEM:OnEquip(ply) 
   ply:StripWeapon('weapon_zm_improvised') 
    if not ply:IsSpec() then 
      ply:Give(self.WeaponClass) 
      ply:SelectWeapon(self.WeaponClass) 
    end 
end 

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

If you’re completely lost on what we’re doing here, I suggest digging up some SWEP tutorials so it all makes a bit more sense, good luck!

Im using the code you provided and I have modified it for the lightsaber addon I am using but when I buy the lightsaber it doesn’t show up in the weapons, it just removes the crowbar completely and there is no weapon slot for 1. For my lightsaber addon I converted the file to TTT with SWEP.Base = “weapon_tttbase”. Was I supposed to do that?

Why not just change the model to a lightsaber?
All you need is the .mdl file, not even the lua code for the lightsaber

So you’re saying I don’t have to convert the weapon to TTT? I can just directly go to pointshop?
Edit: I read console and it says something about

Attempted to create unknown entity type weapon_zm_lightsaber!
NULL Ent in GiveNamedItem!