How would I fix this NPC problem?

How do I fix this problem?

Garrysmod.org DL Link: http://www.garrysmod.org/downloads/?a=view&id=101997

Error in game: [gamemodes\darkrp\gamemode\drpnpc.lua:13] attempt to index global ‘buyers’ (a nil value)

drpnpc.lua



AddCSLuaFile("cl_drpnpc.lua")
AddCSLuaFile("drpnpcshared.lua")
AddCSLuaFile("colchat.lua")

require("glon")

local npcs = {}

local function makenpc(ply, cmd, args)
	if !ply:IsSuperAdmin() then return end

	local kind = args[1]
	if buyers[kind] == nil then return end
	
	local mdl = args[2] or "models/barney.mdl"
	if UTIL_IsUselessModel( mdl ) then return end
	
	local nam = args[3] or "John"

	local ent = ents.Create("npc_buyer")
	ent:SetPos(ply:GetEyeTraceNoCursor().HitPos + Vector(0,0,5))
	local ihatepitch = ply:EyeAngles()
	ihatepitch.p = 0 -- OWNED HAHA TAKE THAT USELESS ANGLE ATTRIBUTE
	ent:SetAngles(ihatepitch)
	ent.buytype = kind
	ent.model = mdl
	ent.name = nam
	ent:Spawn()
	ent:Activate()
	
	table.insert(npcs, ent)
	
	ply:ColChat("DrpNPC", Color(0,255,0), "Buyer succesfully created! Use drp_labpos " .. ent:EntIndex() .. " to set the label for this npc.")
end
concommand.Add("drp_makebuyer", makenpc)

local function saveall(ply,cmd,args)
	if !ply:IsSuperAdmin() then return end
	
	local data = {}
	for k,v in pairs(npcs) do
		if v:GetDTVector(0) == Vector(0,0,0) then
			print("Skipped npc with model " .. v.model .. " because of missing label.")
		else
			table.insert(data, {mdl = v.model, pos = v:GetPos(), ang = v:GetAngles(), tipe = v.buytype, lpos = v:GetDTVector(0), lang = v:GetDTAngle(0), nam = v.name})
		end
	end
	local dir = "drpnpc/" .. game.GetMap() .. ".txt"
	file.Write(dir, glon.encode(data))
end
concommand.Add("drp_savenpcs", saveall)

local function setlabpos(ply,cmd,args)
	if !ply:IsSuperAdmin() then return end
	
	local id = args[1]
	local ent = Entity(id)
	
	if IsValid(ent) and ent:GetClass() == "npc_buyer" then
		local tr = ply:GetEyeTrace()
		ent:SetDTVector(0, tr.HitPos + tr.HitNormal*2)
		ent:SetDTAngle(0, (tr.HitNormal):Angle())
	end
end
concommand.Add("drp_labpos", setlabpos)

local function gravpickup( ply, ent )
	ent.picker = ply
end
hook.Add("GravGunOnPickedUp", "setpicker", gravpickup)

local function gravdrop(ply,ent)
	if ent.picker then ent.picker = nil end
end
hook.Add( "GravGunOnDropped", "removepicker", gravdrop)

local function load()
	local dir = "drpnpc/" .. game.GetMap() .. ".txt"
	if file.Exists(dir) then
		for k,v in pairs(glon.decode(file.Read(dir))) do
			local ent = ents.Create("npc_buyer")
			ent.model = v.mdl
			ent:SetPos(v.pos)
			ent:SetAngles(v.ang)
			ent.buytype = v.tipe
			ent.name = v.nam
			ent:Spawn()
			ent:Activate()
			
			table.insert(npcs, ent)
			
			ent:SetDTVector(0, v.lpos)
			ent:SetDTAngle(0, v.lang)
		end
	end
end
hook.Add( "InitPostEntity", "addstuff", load)

local function latenoob(ply)
	for k,v in pairs(ents.FindByClass("npc_buyer")) do
			umsg.Start("buyerinfo", ply)
				umsg.Short(v:EntIndex())
				umsg.String(v.name)
				umsg.String(v.buytype)
			umsg.End()
	end
end
hook.Add( "PlayerInitialSpawn", "loser", latenoob)


Use [lua] tags, also buyer is never specified.

It worked before the update but after now it broke. So the buyer must be…

Show where buyer is defined then.

Buyers is defined in drpnpcshared.lua. Are you sure you didn’t accidentally delete that file, or misplace it.

Yea it’s in the same folder and untouched.

Hello? Someone please help!