NPC shop help!

Hello im pretty new to lua and im trying to make a NPC shop for a darkRP server. I have looked at the practically only 2 NPC shop tutorials online and none of them have helped. none of them have given me options on where to put what the shop is selling. also i need to make this a VIP and admin only thing. (this is based off here (currently unreachable)

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

– Since this file is ran by both the client and the server, both will share this information.
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/humans/group01/female_01.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: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:SetMaxYawSpeed( 90 ) --Sets the angle by which an NPC can rotate at once.


function ENT:OnTakeDamage()
return false – This NPC won’t take damage from anything.

function ENT:AcceptInput( Name, Activator, Caller )

if Name == "Use" and Caller:IsPlayer() then
	umsg.Start("ShopNPCUsed", 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.


include(‘shared.lua’) – At this point the contents of shared.lua are ran on the client only.

function NPCShopMenu()

-- Small derma panel just for the example.
local pShop = vgui.Create('DFrame')
pShop:SetSize(334, 63)
pShop:SetPos(ScrW()*0.5, ScrH()*0.5)
pShop:SetTitle('VIP Shop')

-- We can also do anything else the client can do, like using the chat!
chat.AddText(Color(255,255,128), "Merchant: ",Color(255,255,255), "Welcome to my shop, how can I help you?" )


usermessage.Hook(“ShopNPCUsed”, NPCShopMenu) --Hook to messages from the server so we know when to display the menu.

First I suggest you start putting your code in code tags to make it readable. Also, you can take a look at This Car Shop to see if it will help you. As a beginner I personally don’t recommend you do this as your first project.

This car shop is badly coded imo, but at least it works i suppose. A NPC Shop is challenging for a beginner, but at least it shows courage :3

Could i edit the car shop to make it sell items or weapons?

Of course you could, but you shouldn’t. You’re heading in too advanced; before you do anything, at least learn basic fundamentals of Lua.