Whats wrong with this?

Hey, I’m trying to make a entity run a console command when you press E on it…

init.lua


function ENT:Initialize( )
 
	self:SetModel( "models/props_lab/monitor01a.mdl" )
	self:SetSolid(  SOLID_BBOX )
	self:SetUseType( SIMPLE_USE )
	
end

function ENT:Use( activator, caller )
 
	if ( activator:IsPlayer() ) then
 
	RunConsoleCommand("pweb")
 
	end
 
end

cl_init.lua



include('shared.lua')

ENT.RenderGroup = RENDERGROUP_OPAQUE

/*---------------------------------------------------------
   Name: Draw
   Desc: Draw it!
---------------------------------------------------------*/
function ENT:Draw()
	self.Entity:DrawModel()
end

shared.lua


 	
ENT.Type 		= "anim"
ENT.Base 		= "base_entity"

ENT.PrintName	= "Computer"
ENT.Author		= "Polar"
ENT.Contact		= "http://www.fusion-gaming.org"

ENT.Spawnable			= false
ENT.AdminSpawnable		= true

AddCSLuaFile( "shared.lua" )

/*---------------------------------------------------------
   Name: Initialize
---------------------------------------------------------*/
function ENT:Initialize()

end

function ENT:Use( activator, caller )
	if CLIENT then return end
	
	if ( activator:IsPlayer() ) then
 
	RunConsoleCommand("pweb")
	
 
	end
 
end


Error…



[lua\vgui\dimage.lua:63] Material missing: VGUI/entities/polar_computer


Any help would be fantastic!

Can you show us your dimage.lua code? Also, make sure polar_computer is added with resource.AddFile(). Also, use [lua][./lua] tags, without the . of course.

-snip-

/

That’s not a lua error from your code. It just means you have not setup an icon for it in the spawnmenu.

Ah, well.

Then it just doesn’t spawn, any ideas why?

Try spawning it with ent_create.

To spawn it using the spawnmenu you’ll need to add a spawn function to it.

Cool, Many thanks!