I keep getting these LUA errors with my 3d_car_dealer
0 replies, posted
[ERROR] addons/3d_car_dealer/lua/autorun/3dcardealer_shopvgui.lua:548: attempt to index local 'CurCarDB' (a nil value)
1. unknown - addons/3d_car_dealer/lua/autorun/3dcardealer_shopvgui.lua:548
[ERROR] addons/3d_car_dealer/lua/autorun/3dcardealer_shopvgui.lua:603: attempt to index local 'CurCarDB' (a nil value)
1. unknown - addons/3d_car_dealer/lua/autorun/3dcardealer_shopvgui.lua:603
[ERROR] addons/3d_car_dealer/lua/autorun/3dcardealer_shopvgui.lua:615: attempt to index local 'CurCarDB' (a nil value)
1. unknown - addons/3d_car_dealer/lua/autorun/3dcardealer_shopvgui.lua:615
[ERROR] addons/3d_car_dealer/lua/autorun/3dcardealer_shopvgui.lua:627: attempt to index local 'CurCarDB' (a nil value)
1. unknown - addons/3d_car_dealer/lua/autorun/3dcardealer_shopvgui.lua:627
[ERROR] addons/3d_car_dealer/lua/autorun/3dcardealer_shopvgui.lua:643: attempt to index local 'CurCarDB' (a nil value)
1. unknown - addons/3d_car_dealer/lua/autorun/3dcardealer_shopvgui.lua:643
[ERROR] addons/3d_car_dealer/lua/autorun/3dcardealer_shopvgui.lua:659: attempt to index local 'CurCarDB' (a nil value)
1. unknown - addons/3d_car_dealer/lua/autorun/3dcardealer_shopvgui.lua:659
And this is my 3dcardealer_shopvgui.lua
[CODE]local meta = FindMetaTable("Player");
function meta:GetJobName()
local JOB = team.GetName(self:Team())
return JOB
end
if CLIENT then
net.Receive( "RXCAR_OpenShop_S2C", function( len,ply )
local DATA = net.ReadTable()
D3DCarDealer_Open(DATA.Ent,DATA.NC)
end)
net.Receive( "RXCAR_UpdateNearCar_S2C", function( len,ply )
local DATA = net.ReadTable()
if D3DCarShopPanel and D3DCarShopPanel.SellerNPC == DATA.Ent then
D3DCarShopPanel.NearMyCars = DATA.NC
end
end)
net.Receive( "RXCAR_Notice_S2C", function( len,ply )
local DATA = net.ReadTable()
if D3DCarShopPanel and D3DCarShopPanel:IsValid() then
D3DCarShopPanel:Notice(DATA.T)
if DATA.RF then
D3DCarShopPanel:RefreshCurrentMode()
end
end
end)
function RXCAR_BuyCar(uniquename,sellernpc,PANEL,ToInv)
net.Start( "RXCAR_Shop_Buy_C2S" )
net.WriteTable({UN=uniquename,SE=sellernpc,TuneData=PANEL.TuneData,ToInv=ToInv})
net.SendToServer()
end
function RXCAR_SellCar(CarENT,CData)
net.Start( "RXCAR_Shop_Sell_C2S" )
net.WriteTable({E=CarENT,CD=CData})
net.SendToServer()
end
function RXCAR_StoreCar(CarENT)
net.Start( "RXCAR_Shop_Store_C2S" )
net.WriteTable({E=CarENT})
net.SendToServer()
end
function RXCAR_RespawnINVCar(UniqueID,sellernpc)
net.Start( "RXCAR_RespawnINV_C2S" )
net.WriteTable({UN=UniqueID,SE=sellernpc})
net.SendToServer()
end
function RXCAR_UpdateINVCar(UniqueID,TuneData)
net.Start( "RXCAR_UpdateINVCar_C2S" )
net.WriteTable({UniqueID=UniqueID,TuneData=TuneData})
net.SendToServer()
end
function RXCAR_SellINVCar(UniqueID,sellernpc)
net.Start( "RXCAR_SellINVCar_C2S" )
net.WriteTable({UN=UniqueID,SE=sellernpc})
net.SendToServer()
end
end
if SERVER then
util.AddNetworkString( "RXCAR_OpenShop_S2C" )
util.AddNetworkString( "RXCAR_UpdateNearCar_S2C" )
util.AddNetworkString( "RXCAR_Notice_S2C" )
util.AddNetworkString( "RXCAR_Shop_Buy_C2S" )
util.AddNetworkString( "RXCAR_Shop_Store_C2S" )
util.AddNetworkString( "RXCAR_Shop_Sell_C2S" )
util.AddNetworkString( "RXCAR_RespawnINV_C2S" )
util.AddNetworkString( "RXCAR_UpdateINVCar_C2S" )
util.AddNetworkString( "RXCAR_SellINVCar_C2S" )
function meta:Send3DShopNotice(txt,refresh)
net.Start( "RXCAR_Notice_S2C" )
net.WriteTable({T=txt,RF=refresh})
net.Send(self)
end
function meta:UpdateNearCar(shopent)
local NearCar = {}
for k,v in pairs(ents.FindInSphere(shopent:GetPos(),300)) do
if v.VehicleName and v.OwnerID == self:SteamID() then
table.insert(NearCar,{Ent=v,VN=v.VehicleName})
end
end
net.Start( "RXCAR_UpdateNearCar_S2C" )
net.WriteTable({Ent=shopent,NC=NearCar})
net.Send(self)
end
function RXCAR_OpenShop(ply,ent)
local NearCar = {}
for k,v in pairs(ents.FindInSphere(ent:GetPos(),300)) do
if v.VehicleName and v.OwnerID == ply:SteamID() then
table.insert(NearCar,{Ent=v,VN=v.VehicleName})
end
end
net.Start( "RXCAR_OpenShop_S2C" )
net.WriteTable({Ent=ent,NC=NearCar})
net.Send(ply)
end
net.Receive( "RXCAR_UpdateINVCar_C2S", function( len,ply )
local DATA = net.ReadTable()
local UniqueID = DATA.UniqueID
local TuneData = DATA.TuneData
RX3DCar_UpdateINVCarData(ply,UniqueID,TuneData)
ply:Send3DShopNotice("New Tuning Data has been updated")
end)
net.Receive( "RXCAR_Shop_Store_C2S", function( len,ply )
local DATA = net.ReadTable()
local Ent = DATA.E
RX3DCar_StoreCar(ply,Ent)
ply:Send3DShopNotice("You Stored the car")
end)
net.Receive( "RXCAR_Shop_Sell_C2S", function( len,ply )
local DATA = net.ReadTable()
local Ent = DATA.E
local CData = DATA.CD
if !Ent or !Ent:IsValid() then return end
Ent.IgnoreRemoveHookTime = CurTime() + 999
D3DCarCrashSaver:RemoveCar(ply,Ent)
Ent:Remove()
D3DCar_Meta:AddMoney(ply,CData.CarRefund or CData.CarPrice/2)
ply:Send3DShopNotice("You sold a car for " .. CData.CarRefund or CData.CarPrice/2,true)
end)
net.Receive( "RXCAR_RespawnINV_C2S", function( len,ply )
local DATA = net.ReadTable()
if !DATA.SE or !DATA.SE:IsValid() then return end
if DATA.SE:GetClass() != "rm_car_dealer" then return end
RX3DCar_SpawnStoredCar(ply,DATA.SE,DATA.UN)
end)
net.Receive( "RXCAR_SellINVCar_C2S", function( len,ply )
local DATA = net.ReadTable()
if !DATA.SE or !DATA.SE:IsValid() then return end
if DATA.SE:GetClass() != "rm_car_dealer" then return end
RX3DCar_SellStoredCar(ply,DATA.SE,DATA.UN)
end)
net.Receive( "RXCAR_Shop_Buy_C2S", function( len,ply )
local DATA = net.ReadTable()
if !DATA.SE or !DATA.SE:IsValid() then return end
if DATA.SE:GetClass() != "rm_car_dealer" then return end
local ToInv = DATA.ToInv
local CData = nil
for k,v in pairs(D3DCarConfig.Car) do
if v.VehicleName == DATA.UN then
CData = v
continue
end
end
if !CData then return end
if !ToInv and CData.MaxAmount then
local Count = 0
for k,v in pairs(ents.GetAll()) do
if v.VehicleName and v.OwnerID == ply:SteamID() and v.VehicleName == CData.VehicleName then
Count = Count + 1
if Count >= CData.MaxAmount then
ply:Send3DShopNotice("Car amount limit!")
return
end
end
end
end
if CData.AvaliableGroup then
local GroupCheck = false
for k,v in pairs(CData.AvaliableGroup) do
if ply:GetNWString("usergroup") == v then
GroupCheck = true
end
end
if !GroupCheck then
ply:Send3DShopNotice("You need Group that can buy this car")
return
end
end
if CData.AvaliableTeam then
local GroupCheck = false
for k,v in pairs(CData.AvaliableTeam) do
if ply:GetJobName() == v then
GroupCheck = true
end
end
if !GroupCheck then
ply:Send3DShopNotice("You need to be job that can buy this car")
return
end
end
if ply:getDarkRPVar("money") < CData.CarPrice then return end
if ToInv then
D3DCar_Meta:Notify( ply, 1, 3, "You bought a car for $"..CData.CarPrice.."! and your car was stored in inventory.")
D3DCar_Meta:AddMoney(ply,-CData.CarPrice)
ply:Send3DShopNotice("You bought a car for " .. CData.CarPrice,true)
RX3DCar_AddCarToInv(ply,CData,DATA.TuneData)
else
D3DCar_Meta:Notify( ply, 1, 3, "You bought a car for $"..CData.CarPrice.."! and your car was stored in inventory.")
D3DCar_Meta:AddMoney(ply,-CData.CarPrice)
ply:Send3DShopNotice("You bought a car for " .. CData.CarPrice,true)
DATA.SE:BuyCar(ply,CData,DATA.TuneData)
end
end)
end
if CLIENT then
function D3DCarDealer_Open(SellerNPC,NearMyCars)
if D3DCarShopPanel and D3DCarShopPanel:IsValid() then
D3DCarShopPanel:Remove()
Sorry, you need to Log In to post a reply to this thread.