Need help with NPC shop

I have the NPC spawning, unable to move, or take damage. Now I need to set it up so useing the NPC (push e) opens a derma menu, but I can’t seem to figure out how to do that. Every tutorial that I have found so far regarding NPC shops is i suspect outdated.
This is my code so far in init:
[LUA]function GM:ShowTeam(ply)
if SERVER then
CarDealer = ents.Create(“npc_citizen”)
CarDealer:SetPos(Vector(-3491, -6450, 380))
CarDealer:SetAngles(Angle(0, -133, 0))
CarDealer:Spawn()
CarDealer.Base = “base_ai” – This entity is based on “base_ai”
CarDealer.Type = “ai” – What type of entity is it, in this case, it’s an AI.
CarDealer.AutomaticFrameAdvance = true – This entity will animate itself.

CarDealer:SetModel( "models/breen.mdl" ) -- Sets the model of the NPC.
CarDealer:SetHullType( HULL_HUMAN ) -- Sets the hull type, used for movement calculations amongst other things.
CarDealer:SetHullSizeNormal( )
CarDealer:SetNPCState( NPC_STATE_SCRIPT )
CarDealer:SetSolid(  SOLID_BBOX ) -- This entity uses a solid bounding box for collisions.
CarDealer:CapabilitiesRemove(CAP_MOVE_GROUND)
CarDealer:CapabilitiesAdd( CAP_ANIMATEDFACE, CAP_TURN_HEAD ) -- Adds what the NPC is allowed to do ( It cannot move in this case ).
CarDealer:SetUseType( SIMPLE_USE ) -- Makes the ENT.Use hook only get called once at every use.
CarDealer:DropToFloor()

end

function ENTITY:AcceptInput( Name, Activator, Caller )

if Name == "Use" and Caller:IsPlayer() then
	
	umsg.Start("ChangeClass", Caller) -- Prepare the usermessage to that same player to open the menu on his side.
	umsg.End() -- We don't need any content in the usermessage so we're sending it empty now.
	
end

end
end[/LUA]

With this code I get this error:
attempt to index global ‘ENTITY’ (a nil value)

If you know what my problem is, please let me know.
Thanks

What I usually do when creating a NPC is creating a folder inside lua/entities

name it example

then inside of the example folder have 3 lua files, cl_init, init, shared

in cl_init you would have



function ournpc()

derma ... 

end

usermessage.Hook("npcofdoom", ournpc) // sending npcofdoom to server,


then in init you would have




AddCSLuaFile( "cl_init.lua" ) -- This means the client will download these files
AddCSLuaFile( "shared.lua" )

include('shared.lua') -- At this point the contents of shared.lua are ran on the server only.


function ENT:Initialize( ) --This function is run when the entity is created so it's a good place to setup our entity.
	
	self:SetModel( "models/breen.mdl" ) -- Sets the model of the NPC.
	self:SetHullType( HULL_HUMAN ) -- Sets the hull type, used for movement calculations amongst other things.
	self:SetHullSizeNormal( )
	self:SetNPCState( NPC_STATE_SCRIPT )
	self:SetSolid(  SOLID_BBOX ) -- This entity uses a solid bounding box for collisions.
	self:CapabilitiesAdd( CAP_ANIMATEDFACE, CAP_TURN_HEAD ) -- Adds what the NPC is allowed to do ( It cannot move in this case ).
	self:SetUseType( SIMPLE_USE ) -- Makes the ENT.Use hook only get called once at every use.
	self:DropToFloor()
	
	self:SetMaxYawSpeed( 90 ) --Sets the angle by which an NPC can rotate at once.
	
end

function ENT:OnTakeDamage()
	return false -- This NPC won't take damage from anything.
end 	

function ENT:AcceptInput( Name, Activator, Caller )	

	if Name == "Use" and Caller:IsPlayer() then
		
		umsg.Start("npcofdoom", Caller) -- Prepare the usermessage to that same player to open the menu on his side.
		umsg.End() -- We don't need any content in the usermessage so we're sending it empty now.
		
	end
	
end

function SpawnShopNPC()
	if game.GetMap() == "MAPNAME GOES HERE" then
		OURNPC = ents.Create("example")
		OURNPC:SetPos(Vector(position of the npc) ) // type getpos in console then copy the first 3 numbers, like 125.00, 1251.00. 0000
		OURNPC:SetAngles(Angle(npcs angle) ) // after setang; copy the 3 numbers
		OURNPC:Spawn()
	end
end



and then finally in shared you would have



ENT.Base = "base_ai" -- This entity is based on "base_ai"
ENT.Type = "ai" -- What type of entity is it, in this case, it's an AI.
ENT.AutomaticFrameAdvance = true -- This entity will animate itself.
 
function ENT:SetAutomaticFrameAdvance( bUsingAnim ) -- This is called by the game to tell the entity if it should animate itself.
	self.AutomaticFrameAdvance = bUsingAnim
end

-- Since this file is ran by both the client and the server, both will share this information.


Thanks for your help! What do I need to put in the server’s init file to spawn the npc?

EDIT:
Nevermind! I found out how to do it from a really old post, thanks for the help though!