I’m trying to spawn a custom entity that is contained within the lua/entities folder. I have a spawnmenu with icons and whenever I click it, nothing spawns. I don’t even get any errors.
include('shared.lua')
function MainMenu( )
equipment = {}
equipment[1] = "models/props_c17/signpole001.mdl"
equipment[2] = "lua/entities/fishing_rod/cl_init.lua"
local frame = vgui.Create("DFrame")
local IconList = vgui.Create( "DPanelList", frame )
frame:Center()
frame:SetSize(220,200)
frame:SetTitle("Tacklebox")
frame:MakePopup()
IconList:EnableVerticalScrollbar( true )
IconList:EnableHorizontal( true )
IconList:SetPadding( 4 )
IconList:SetPos(10,30)
IconList:SetSize(200, 160)
for k,v in pairs(equipment) do
local icon = vgui.Create( "SpawnIcon", IconList )
icon:SetModel( v )
IconList:AddItem( icon )
icon.DoClick = function( icon ) surface.PlaySound( "ui/buttonclickrelease.wav" ) RunConsoleCommand("gm_spawn", v) end
end
end
This is in Garry’s Mod 13 by the way.