NPC car Dealer's car wont spawn

Hello im new to the forums but anyway i have for some reason not being able to deploy my cars i have bought on my server it is giving me this error…
http://imgur.com/zMxqCnD i have been trying to fix it but nothing happens and still fails.

[editline]31st October 2013[/editline]

if not SERVER then return end

util.AddNetworkString( “npcshop_senddata” )

function SpawnnpcShop()
local shop = ents.Create(“npc_shop”)
shop:SetPos( Vector(1779, -4483, -134) )
shop:SetAngles( Angle(5, -92, 0) )
shop:Spawn()
shop:DropToFloor()
end

hook.Add(“InitPostEntity”, “SpawnnpcShop”, SpawnnpcShop)

hook.Add(“EntityTakeDamage”, “PReventNPCfromdying”, function( target, dmginfo )
if target:IsNPC() and target:GetClass() == “npc_shop” then
dmginfo:ScaleDamage(0)
end
end)

local function IsVIP(ply)
local isvip = false
for k,v in pairs(NPCSHOP.UserGroups) do
if ply:GetUserGroup() == v then
isvip = true
break
end
end
return isvip
end

//Utilizes darkrp’s notify
local function Notify(ply, text)
if not IsValid(ply) then return end
umsg.Start("_Notify", ply)
umsg.String(text)
umsg.Short(0)
umsg.Long(4)
umsg.End()
end

local function SaveVehicles()
local str = util.TableToJSON(NPCSHOP.PlayerVehicles)
file.Write( “npcshopsaves.txt”, str )
end
local function LoadVehicles()
local str = file.Read( “npcshopsaves.txt”, “DATA” ) or “
NPCSHOP.PlayerVehicles = util.JSONToTable(str)
end
LoadVehicles()
function SendVehicles(ply)
local sid = ply:SteamID()
local cars = NPCSHOP.PlayerVehicles[sid] or {}

net.Start("npcshop_senddata")
	net.WriteTable(cars)
net.Send(ply)

end

hook.Add(“PlayerInitialSpawn”, “plyinitspawnnpcshop”, function(ply)
timer.Simple(2, function()
SendVehicles(ply)
end)
end)

local meta = FindMetaTable(“Player”)
function meta:AddVehicle( class )
local sid = self:SteamID()
if not NPCSHOP.PlayerVehicles[sid] then NPCSHOP.PlayerVehicles[sid] = {} end

NPCSHOP.PlayerVehicles[sid][class] = true
SaveVehicles()
SendVehicles(self)

end

local function SpawnVehicle(ply, class)
if not NPCSHOP.VehicleLookup[class] then return end
if not NPCSHOP.Vehicles[NPCSHOP.VehicleLookup[class]] then return end

if IsValid(ply.currentcar) then
	local d = ply.currentcar:GetDriver()
	if IsValid(d) and d != ply then
		Notify(d, "The owner of this car has removed it!")
	end
	ply.currentcar:Remove()
end

local vehicle = list.Get("Vehicles")[class]
if not vehicle then return end

local car = ents.Create(vehicle.Class)
	if not car then return end
	
	car:SetModel(vehicle.Model)
	
	if vehicle.KeyValues then
		for k, v in pairs(vehicle.KeyValues) do
			car:SetKeyValue(k, v)
		end
	end

	car.VehicleName = class
	car.VehicleTable = vehicle
	car.Owner = ply

local carspawns = NPCSHOP.CarSpawn[game.GetMap()]
local pos = carspawns[1].pos
local ang = carspawns[1].ang
for k,tbl in pairs(carspawns) do
	local p,a = tbl.pos, tbl.ang
	local entslist = ents.FindInBox(Vector(p.x + 100, p.y + 100, p.z - 20), Vector(p.x - 100, p.y - 100, p.z + 150))
	if #entslist == 0 then
		pos = p
		ang = a
		break
	end
end

car:SetPos(pos)
car:SetAngles(ang)

car:Spawn()
car:Activate()
car.SID = ply.SID
car.ClassOverride = vehicle.Class
if vehicle.Members then
	table.Merge(car, vehicle.Members)
end
car:Own(ply)
gamemode.Call("PlayerSpawnedVehicle", ply, car)

ply.currentcar = car

end

concommand.Add("_npcshopbtnclick", function(ply, _, args)
if #args != 1 then return end
if not IsValid(ply) then return end

if ply:GetPos():Distance(ents.FindByClass("npc_shop")[1]:GetPos()) > 80 then return end

local class = args[1]
if not NPCSHOP.VehicleLookup[class] then return end
if not NPCSHOP.Vehicles[NPCSHOP.VehicleLookup[class]] then return end

local cltbl = NPCSHOP.Vehicles[NPCSHOP.VehicleLookup[class]]

if #cltbl.job > 0 then
	if not table.HasValue(cltbl.job, ply:Team()) then
		Notify(ply, "You're not in the correct job to spawn/purchase this!")
		return
	end
end

if ply:OwnsVehicle(class) then
	SpawnVehicle(ply, class)
	return
end

if cltbl.viponly and not IsVIP(ply) then
	Notify(ply, "This vehicle is VIP only!")
	return
end

if not ply:CanAfford(cltbl.price) then
	Notify(ply, "You can not afford that!")
	return
end

ply:AddMoney(-cltbl.price)
Notify(ply, "You've bought the '" .. cltbl.name .. "' for "..(CUR or "$")..(cltbl.price).."!")
ply:AddVehicle(class)

umsg.Start("_updatenpcshopgui", ply)
	umsg.String(class)
umsg.End()

end)

// DarkRP doesn’t give me any way to check for job changes, then this shit is needed!

local bkp = meta.SetTeam
meta.SetTeam = function(self, job)
bkp(self, job)

if IsValid(self.currentcar) then
	local class = self.currentcar.VehicleName
	local cltbl = NPCSHOP.Vehicles[NPCSHOP.VehicleLookup[class]]
	
	if #cltbl.job > 0 then
		if not table.HasValue(cltbl.job, self:Team()) then
			self.currentcar:Remove()
			Notify(self, "Your current car isn't allowed for your new job!")
			return
		end
	end
end

[editline]31st October 2013[/editline]

/*
Only change stuff in here!
*/
NPCSHOP = NPCSHOP or {}
NPCSHOP.CarSpawn = {}
NPCSHOP.NPCSpawn = {}

/*
Edit stuff below this line


*/
// Model of the NPC, can be changed to whatever you want, as long as it follows this path of models/<modelname>.mdl
NPCSHOP.NPCModel = “models/vortigaunt.mdl”

//Position of the NPC, in YOUR console, type getpos to get positioning co-ordinates

NPCSHOP.NPCSpawn[“RP_<EvoCity2_v2p>”] = { //Put the actual map name in
pos = Vector(1429, -1916, 304),
ang = Angle(10, 175, 0)
}

//Position for the carspawn

NPCSHOP.CarSpawn[“RP_<EvoCity2_v2p>”] = {
{
pos = Vector(2874.538574, -2967,498291, 140.990326),
ang = Angle(2.859685, -178.260345, 0.000000)
},
}

//Which ULX usergroups are considered “Donator”
NPCSHOP.UserGroups = {“donator”, “admin”, “superadmin”}

/*=-=-=-=-=-=-=-=-=-=-==–=-=-=-=-=-=HOW TO ADD VEHICLES=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Add vehicles here.

The jobrestriction is abit wonky, in darkrp you can just do like {TEAM_POLICE, TEAM_CHIEF, TEAM_MAYOR} but it doesn’t really work the same here.
Jobrestriction is put with {1,2,3} where 1, 2 and 3 are the team numbers of those teams, in order to get the team numbers, just go ingame, open console
using F11 and type “lua_run_cl print(TEAM_CITIZEN)” which will give you the team number for citizen. You can also get the teamnumber of your current
team by typing “lua_run_cl print(LocalPlayer():Team())”
If you add or remove darkrp teams, this process (in some cases) have to be done again!

NPCSHOP.AddVehicle(name, class, model, price, jobrestriction, donatoronly)
name: Name of the vehicle in the npcshop menu
class: Vehicle-class of the vehicle. Use “rp_getvehicles” to find these.
model: Model which will appear in the npcshop menu
price: How much it costs
jobrestriction: What jobs will be able to buy this (type nil if its available to all jobs)
donatoronly: Is this vehicle only available for donator’s? true/false
Display name > Class (rp_getvehicles in console) > Model directory > Price > Jobs > Donator/Not Donator - False = Not Donator, True = Donator
*/
NPCSHOP.AddVehicle(“Jeep”, “Jeep”, “models/buggy.mdl”, 50000, nil, false )
NPCSHOP.AddVehicle(“Airboat”, “Airboat”, “models/airboat.mdl”, 100000, nil, false )
NPCSHOP.AddVehicle(“Bugatti Veyron SS”, “veyronsstdm”, “models/tdmcars/bug_veyronss.mdl”, 1500000, nil, false )
NPCSHOP.AddVehicle(“Ford Transit”, “transittdm”, “models/tdmcars/ford_transit”, 35000, nil, false )
NPCSHOP.AddVehicle(“Lamborghini Murcielago”, “murcielagotdm”, “models/tdmcars/murcielago.mdl”, 450000, nil, false )
NPCSHOP.AddVehicle(“Ford Shelby GT500”, “gt500tdm”, “models/tdmcars/gt500.mdl”, 45000, nil, false )
NPCSHOP.AddVehicle(“Ferrari 458 Spider”, “458spidtdm”, “models/tdmcars/fer_458spid.mdl”, 500000, nil, false )
NPCSHOP.AddVehicle(“Audi R8”, “audir8tdm”, “models/tdmcars/audir8.mdl”, 13000, nil, false )
NPCSHOP.AddVehicle(“Aston Martin DBS”, “dbstdm”, “models/tdmcars/dbs.mdl”, 266000, nil, false )
NPCSHOP.AddVehicle(“Mercedes SL65 AMG”, “sl65amgtdm”, “models/tdmcars/sl65amg.mdl”, 97462, nil, false )
NPCSHOP.AddVehicle(“Porsche 997 GT3”, “cayennetdm”, “models/tdmcars/997gt3.mdl”, 250000, nil, false )
NPCSHOP.AddVehicle(“Chrysler 300c”, “300ctdm”, “models/tdmcars/chr_300c.mdl”, 320551, nil, false )

[editline]31st October 2013[/editline]

SORRY THIS IS MY SERVER.LAU NOT THE FIRST ONE SORRY
if not SERVER then return end

util.AddNetworkString( “npcshop_senddata” )

function SpawnnpcShop()
local shop = ents.Create(“npc_shop”)
shop:SetPos( Vector(1429, -1916, 304) )
shop:SetAngles( Angle(10, 175, 0) )
shop:Spawn()
shop:DropToFloor()
end

hook.Add(“InitPostEntity”, “SpawnnpcShop”, SpawnnpcShop)

hook.Add(“EntityTakeDamage”, “PReventNPCfromdying”, function( target, dmginfo )
if target:IsNPC() and target:GetClass() == “npc_shop” then
dmginfo:ScaleDamage(0)
end
end)

local function IsDonator(ply)
local isdonator = false
for k,v in pairs(NPCSHOP.UserGroups) do
if ply:GetUserGroup() == v then
isdonator = true
break
end
end
return isdonator
end

//Utilizes darkrp’s notify
local function Notify(ply, text)
if not IsValid(ply) then return end
umsg.Start("_Notify", ply)
umsg.String(text)
umsg.Short(0)
umsg.Long(4)
umsg.End()
end

local function SaveVehicles()
local str = util.TableToJSON(NPCSHOP.PlayerVehicles)
file.Write( “npcshopsaves.txt”, str )
end
local function LoadVehicles()
local str = file.Read( “npcshopsaves.txt”, “DATA” ) or “
NPCSHOP.PlayerVehicles = util.JSONToTable(str)
end
LoadVehicles()
function SendVehicles(ply)
local sid = ply:SteamID()
local cars = NPCSHOP.PlayerVehicles[sid] or {}

net.Start("npcshop_senddata")
	net.WriteTable(cars)
net.Send(ply)

end

hook.Add(“PlayerInitialSpawn”, “plyinitspawnnpcshop”, function(ply)
timer.Simple(2, function()
SendVehicles(ply)
end)
end)

local meta = FindMetaTable(“Player”)
function meta:AddVehicle( class )
local sid = self:SteamID()
if not NPCSHOP.PlayerVehicles[sid] then NPCSHOP.PlayerVehicles[sid] = {} end

NPCSHOP.PlayerVehicles[sid][class] = true
SaveVehicles()
SendVehicles(self)

end

local function SpawnVehicle(ply, class)
if not NPCSHOP.VehicleLookup[class] then return end
if not NPCSHOP.Vehicles[NPCSHOP.VehicleLookup[class]] then return end

if IsValid(ply.currentcar) then
	local d = ply.currentcar:GetDriver()
	if IsValid(d) and d != ply then
		Notify(d, "This car has been removed by its owner!")
	end
	ply.currentcar:Remove()
end

local vehicle = list.Get("Vehicles")[class]
if not vehicle then return end

local car = ents.Create(vehicle.Class)
	if not car then return end
	
	car:SetModel(vehicle.Model)
	
	if vehicle.KeyValues then
		for k, v in pairs(vehicle.KeyValues) do
			car:SetKeyValue(k, v)
		end
	end

	car.VehicleName = class
	car.VehicleTable = vehicle
	car.Owner = ply

local carspawns = NPCSHOP.CarSpawn[game.GetMap()]
local pos = carspawns[1].pos
local ang = carspawns[1].ang
for k,tbl in pairs(carspawns) do
	local p,a = tbl.pos, tbl.ang
	local entslist = ents.FindInBox(Vector(p.x + 100, p.y + 100, p.z - 20), Vector(p.x - 100, p.y - 100, p.z + 150))
	if #entslist == 0 then
		pos = p
		ang = a
		break
	end
end

car:SetPos(pos)
car:SetAngles(ang)

car:Spawn()
car:Activate()
car.SID = ply.SID
car.ClassOverride = vehicle.Class
if vehicle.Members then
	table.Merge(car, vehicle.Members)
end
car:Own(ply)
gamemode.Call("PlayerSpawnedVehicle", ply, car)

ply.currentcar = car

end

concommand.Add("_npcshopbtnclick", function(ply, _, args)
if #args != 1 then return end
if not IsValid(ply) then return end

if ply:GetPos():Distance(ents.FindByClass("npc_shop")[1]:GetPos()) &gt; 80 then return end

local class = args[1]
if not NPCSHOP.VehicleLookup[class] then return end
if not NPCSHOP.Vehicles[NPCSHOP.VehicleLookup[class]] then return end

local cltbl = NPCSHOP.Vehicles[NPCSHOP.VehicleLookup[class]]

if #cltbl.job &gt; 0 then
	if not table.HasValue(cltbl.job, ply:Team()) then
		Notify(ply, "You're not in the correct job to spawn/purchase this!")
		return
	end
end

if ply:OwnsVehicle(class) then
	SpawnVehicle(ply, class)
	return
end

if cltbl.donatoronly and not IsDonator(ply) then
	Notify(ply, "You need to be Donator to buy this vehicle!")
	return
end

if not ply:canAfford(cltbl.price) then
	Notify(ply, "You do not have sufficient funds to purchase this!")
	return
end

ply:addMoney(-cltbl.price)
Notify(ply, "You've bought the '" .. cltbl.name .. "' for "..(CUR or "$")..(cltbl.price).."!")
ply:AddVehicle(class)

umsg.Start("_updatenpcshopgui", ply)
	umsg.String(class)
umsg.End()

end)

// DarkRP doesn’t give me any way to check for job changes, then this shit is needed!

local bkp = meta.SetTeam
meta.SetTeam = function(self, job)
bkp(self, job)

if IsValid(self.currentcar) then
	local class = self.currentcar.VehicleName
	local cltbl = NPCSHOP.Vehicles[NPCSHOP.VehicleLookup[class]]
	
	if #cltbl.job &gt; 0 then
		if not table.HasValue(cltbl.job, self:Team()) then
			self.currentcar:Remove()
			Notify(self, "Your current car isn't allowed for your new job!")
			return
		end
	end
end

end


(User was banned for this post ("wrong section" - postal))