TTT Passive Items

Hey everyone,

actually I started to build on my own server for Trouble in Terrorist Town in Garry’s Mod.
I have found an old post, which explained how to create a passive Item.

After small corrections my code looked like this:



EQUIP_ITEMNAME = 8

local function Init()
       local equipitem = {
              id = EQUIP_PASSIVE,
              loadout = false,
              type = "item_passive",
              material = "materials/vgui/ttt/icon_iron.png",
              name = "Ironboots",
              desc = "This pair of Boots allow you to fall without taking any Damage. Also you do explosive Damage, when you fall from great height"
      }
      table.insert( EquipmentItems[ROLE_TRAITOR], equipitem )
	  table.insert( EquipmentItems[ROLE_DETECTIVE], equipitem )
end
hook.Add( "InitPostEntity", "LoadEquipItem", Init )

hook.Add( "EntityTakeDamage", "Ironboots", function( ply, dmginfo )
	if ply:HasEquipmentItem( EQUIP_Ironboots ) and ply:IsPlayer() and dmginfo:IsFallDamage() then
		if dmginfo:IsFallDamage() then
			local explode = ents.Create( "env_explosion" )
			explode:SetPos( target:GetPos() )
			explode:SetOwner( ply )
			explode:Spawn()
			explode:SetKeyValue( "iMagnitude", "100" )
			explode:Fire( "Explode", 0, 0 )
			explode:EmitSound( "weapon_AWP.Single", 400, 400 )
		end
		if dmginfo:IsFallDamage() or dmginfo:IsExplosionDamage() then
			dmginfo:SetDamage(0)		
		end
	end
end)


Now following problem:
The code compiles fine and i also think the function would work,
but whenever I open the shop menu to buy the created item it displays
a nil value. Can anyone please tell me what I can do to fix it?
I am really confused about this. I mean I know the Shop
won’t let me buy it, because the Slot is not specified. But this
is exactly what i wanted to avoid! :ohno:

Thank you and best regards
Luckizockt

Your (global?) variable is called EQUIP_ITEMNAME, but then you do id = EQUIP_PASSIVE

Omg thank you very much.