NPC shop help

Hello everyone! I need a bit of help with making a NPC Drugdealer where you can buy weed from the NPC… I’m not sure how this works… I have searched up some stuff on google, but it doesn’t seem to have helped me.

This will take some gLUA knowledge to do. I can give you the base for a npc and you can work on from there if you would like.

If you can give me that, it would be awesome :slight_smile:

Serverside:
[LUA]AddCSLuaFile( “cl_init.lua” )
AddCSLuaFile( “shared.lua” )
include(‘shared.lua’)

function ENT:Initialize( )
self:SetModel( “models/humans/group01/female_02.mdl” )
self:SetHullType( HULL_HUMAN )
self:SetHullSizeNormal( )
self:SetNPCState( NPC_STATE_SCRIPT )
self:SetSolid( SOLID_BBOX )
self:CapabilitiesAdd( CAP_ANIMATEDFACE, CAP_TURN_HEAD )
self:SetUseType( SIMPLE_USE )
self:DropToFloor()
self:SetMaxYawSpeed( 90 )
end

function ENT:AcceptInput( Name, Activator, Caller )
if Name == “Use” and Caller:IsPlayer() then
umsg.Start(“Shop”, Caller)
umsg.End()
end
end
function ENT:OnTakeDamage()
return false
end
hook.Add(“InitPostEntity”, “spawnnpc”, function()
local npc = ents.Create(“npcshop1”)
npc:SetPos(Vector(-1936.590698, -1915.433716, -131.968750 ))
npc:SetAngles(Angle(0,0,0))
npc:Spawn()
end)[/LUA]
Clientside:
[LUA]include(‘shared.lua’)
function NPCShop()
local pShop = vgui.Create(‘DFrame’)
pShop:SetSize(800, 700)
pShop:SetTitle(“Store”)
pShop:SetSizable(false)
pShop:SetDeleteOnClose(false)
pShop:Center()
pShop:MakePopup()
end
usermessage.Hook(“Shop”, NPCShop)[/LUA]
shared:
[LUA]ENT.Base = “base_ai”
ENT.Type = “ai”
ENT.PrintName = “”
ENT.Author = “”
ENT.Contact = “”
ENT.Purpose = “”
ENT.Instructions = “”
ENT.AutomaticFrameAdvance = true
function ENT:SetAutomaticFrameAdvance( bUsingAnim )
self.AutomaticFrameAdvance = bUsingAnim
end[/LUA]

That’s an old example, might as well give credit where credit is due: http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index7853.html ( This link has the comments intact, your example has them removed and might be less helpful for the OP. I only see a few minor changes… )

You’d have to update that example for GMOD 13.

Example:
[lua]self:CapabilitiesAdd( CAP_ANIMATEDFACE, CAP_TURN_HEAD )[/lua]

would become

[lua]self:CapabilitiesAdd( bit.bor( CAP_ANIMATEDFACE, CAP_TURN_HEAD ) )[/lua]

And I believe there are a few other changes.

Where would I put the entity for the weed_seed??