Help with adding SWEP to Detective/Traitor Credit shop in TTT

I am getting this error when I try to open up the Detective shop after buying a custom weapon in it.
In the SWEP for the weapon, I put the following to add it to the shop:

      { id = EQUIP_TESLA, 
        type     = "item_active",
        material = "vgui/ttt/icon_polter",
        name     = "Tesla Cannon",
        desc     = "Left click to fire bolt of electricity that stuns target. 
 Right click to recharge weapon."

and also

SWEP.CanBuy = {ROLE_DETECTIVE} -- only traitors can buy

The weapon shows up fine in the shop, but after I buy the weapon, the following appears.
[ERROR] gamemodes/terrortown/gamemode/cl_equip.lua:199: attempt to call method ‘IsEquipment’ (a nil value)

  1. unknown - gamemodes/terrortown/gamemode/cl_equip.lua:199
  2. unknown - lua/includes/modules/concommand.lua:54

I honestly have no idea what I am doing, and I haven’t been able to find a tutorial anywhere about how to add SWEPs to the D/T Credit Shop, so I’ve just been doing what sounds correct.
Can anyone point me in the right direction?

[editline]26th April 2015[/editline]

I reduced it to only the following;

   if CLIENT then
   SWEP.PrintName = "Tesla Cannon"
   SWEP.Slot = 6
   SWEP.DrawAmmo = false

   SWEP.ViewModelFOV  = 54
   SWEP.ViewModelFlip = false

  SWEP.EquipMenuData = {
   type = "Weapon",
   desc = "Shoots electricity that stuns target. 

Hold right click to charge."

   SWEP.Icon = "vgui/ttt/icon_polter"


SWEP.CanBuy = {ROLE_DETECTIVE} -- only traitors can buy

I am still getting the same error message if I try to open up the credit shop with the custom weapon equipped, however. According to the error message, “teslacannon:IsEquipment()” returns nil, even though it is indeed equipment, as far as I can tell. I cannot find the IsEquipment function, so I can’t actually tell what it’s looking for, so I don’t know what to do. Can anyone help?

– Always derive from weapon_tttbase
SWEP.Base = “weapon_tttbase”

also the whole part with table.insert… Drop that.
What an Traitor Weapon only needs, you can see here in this basic, well commented, AK-47

  1. Dont use table.insert( equipmentitems ) for SWEPs, thats meant for stuff like armor or radar.

  2. You don’t need SWEP.WeaponID

  3. SWEP.CanBuy is what adds it to the traitor shop