Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [ERROR] addons/car-display/lua/entities/ent_carpad/cl_init.lua:55: attempt to index field 'Selected' (a nil value)
- 1. Draw - addons/car-display/lua/entities/ent_carpad/cl_init.lua:55
- 2. unknown - addons/car-display/lua/entities/ent_carpad/cl_init.lua:49
- -- CONFIG IS BELOW THIS --
- ----------------------------------------------------------------------
- local function AddVehicle(name, price, class, customcheck, cl_scale, base, tags)
- if type(name) == "string" then
- local veh = list.Get("Vehicles")[class]
- if veh == nil then
- table.insert(CAR_DISPLAY_CONFIG.FailedVehicles, {
- ["name"] = name,
- ["price"] = price,
- ["class"] = class,
- ["tags"] = tags,
- ["base"] = base,
- ["trace"] = debug.traceback()
- })
- return
- end
- local index = table.insert(CAR_DISPLAY_CONFIG.Vehicles, {
- ["name"] = name,
- ["price"] = price,
- ["model"] = veh.Model,
- ["script"] = veh.KeyValues.vehiclescript,
- ["class"] = class,
- ["basetype"] = base || "prop_vehicle_jeep",
- ["cl_scale"] = cl_scale || .9,
- ["customcheck"] = customcheck || function() return true end,
- ["allowed_bodygroups"] = {},
- ["allowed_colors"] = {},
- ["tags"] = tags
- })
- CAR_DISPLAY_CONFIG.Vehicles[index]["index"] = index
- elseif type(name) == "table" then
- local tbl = name
- local veh = list.Get("Vehicles")[tbl.class]
- tbl.customcheck = tbl.customcheck || function() return true end
- if veh == nil then
- table.insert(CAR_DISPLAY_CONFIG.FailedVehicles, {
- ["name"] = name,
- ["price"] = price,
- ["class"] = class,
- ["tags"] = tags,
- ["base"] = base,
- ["trace"] = debug.traceback()
- })
- return
- end
- local index = table.insert(CAR_DISPLAY_CONFIG.Vehicles, {
- ["name"] = tbl.name,
- ["price"] = tbl.price,
- ["model"] = veh.Model,
- ["script"] = veh.KeyValues.vehiclescript,
- ["class"] = tbl.class,
- ["basetype"] = tbl.base || "prop_vehicle_jeep",
- ["cl_scale"] = tbl.cl_scale || .9,
- ["customfailmessage"] = tbl.customfailmessage || "You cannot purchase this vehicle!",
- ["customcheck"] = function(ply) return tbl.customcheck(ply), tbl.customfailmessage end,
- ["tags"] = tbl.tags,
- ["allowed_bodygroups"] = tbl.allowed_bodygroups || {},
- ["allowed_colors"] = tbl.allowed_colors || {}
- })
- CAR_DISPLAY_CONFIG.Vehicles[index]["index"] = index
- end
- end
- ----------------------------------------------------------------------
- -- Add your custom vehicles below as follows:
- -- <Display Name> : This shows up on all the screens when players are browsing cars
- -- <Price> : The price the player pays for the car
- -- <Vehicle Class> : Unique Identifier for the car, this is normally found in the vehicle script. If not you can just make it up HOWEVER READ THE BRACKETS (MAKE SURE THEIR UNIQUE THOUGH! ALSO THIS IS USED TO FIND THE SPAWNICON WITHOUT ITLL BE PURPLE AND BLACK SQUARES)
- -- <Custom Check> <Optional> : Custom wrote function that checks if the player is allowed to spawn the car in, returns two arguments <true/false> <message to display> true to allow the spawn, false to not allow the spawn. Message to show if the spawn was not allowed
- -- <Model Scale> <Optional> : Size of the model being displayed on the car pad
- -- <Base Entity> <Optional> : Entity used when creating the vehicle, this defaults to "prop_vehicle_jeep" (Afaik most vehicles use this) if yours uses a different set it here
- -- <Tags> <Optionals> : Tag the cars and it can be used to filter vehicles in game, cars of the same tag can be displayed together e.g. {"Muscle Car", "Sports", "Government"}
- -- <Allowed Bodygroups> <Optional> : Allowed Bodygroups that can be customised on the car
- -- <Allowed Colours> <Optional> : Allowed Colours that can be applied to the car
- -- Examples below
- --[[
- AddVehicle({
- name = "Jeep - HL2",
- price = 150000,
- class = "Jeep",
- customfailmessage = "You are not a donator!",
- customcheck = function(ply) return table.HasValue(ply:GetUserGroup(), {"VIP", "Donator"}),
- cl_scale = .2,
- base = "prop_vehicle_jeep",
- tags = {"Sports"},
- allowed_bodygroups = {
- ["wing"] = true
- },
- allowed_colors = {
- ["Emerald"] = true,
- ["Dark Blue"] = true,
- ["Wetasphalt"] = true,
- }
- })
- ]]--
- ----------------------------------------------------------------------
- function CarDisplay_LoadConfig()
- -- Example Vehicles, all default to gmod :)
- --[[
- Generated using: DarkRP | Vehicle Generator
- https://csite.io/tools/gmod-darkrp-vehicle
- --]]
- DarkRP.createVehicle({
- name = "Audi R8",
- model = "audir8tdm",
- price = 500000,
- label = "Audi R8",
- category = "sport"
- })
- DarkRP.createVehicle({
- name = "Audi R8 GT Spyder",
- model = "audir8spydtdm",
- price = 700000,
- label = "Audi R8 GT Spyder",
- category = "sport"
- })
- DarkRP.createVehicle({
- name = "Audi R8 Plus",
- model = "audir8plustdm",
- price = 1000000,
- label = "Audi R8 Plus",
- category = "sport"
- })
- DarkRP.createVehicle({
- name = "Bugstti EB110",
- model = "eb110tdm",
- price = 3000000,
- label = "Bugatti EB 110",
- category = "super"
- })
- DarkRP.createVehicle({
- name = "Bugstti Veyron",
- model = "veyrontdm",
- price = 4000000,
- label = "Bugatti Veyron",
- category = "super"
- })
- DarkRP.createVehicle({
- name = "Bugstti Veyron SS",
- model = "veyronsstdm",
- price = 5500000,
- label = "Bugatti Veyron SS",
- category = "super"
- })
- -- USE THIS FOR TESTING ALL YOUR SERVERS CARS (May not function on some servers)
- --[[for k,v in pairs(list.Get("Vehicles")) do
- AddVehicle(v.Name, 1000, k, function() return true end, 1, v.Class)
- end--]]
- end
- ------------------------------------------------------------------------
- CAR_DISPLAY_CONFIG.SellPercent = .2 -- Percent of the cars value that should be given back to the player when they sell it.
- CAR_DISPLAY_CONFIG.BuyPercent = .1 -- Percent of the cars original value should be charged when they want to change the colour or bodygroups
- CAR_DISPLAY_CONFIG.MaxSpawnedVehicles = 2 -- The max allowed vehicles a player is allowed out at any one time.
- ------------------------------------------------------------------------
- CAR_DISPLAY_CONFIG.CarColors = { // Default Car Colours
- ["Red"] = Color(255,0,0),
- ["White"] = Color(255,255,255),
- ["Blue"] = Color(0,0,255),
- ["Green"] = Color(0,255,0),
- ["Grey"] = Color(120,120,120),
- ["Black-Grey"] = Color(32,32,32),
- ["Black"] = Color(0,0,0),
- ["Yellow"] = Color(241,196,15),
- ["Light Blue"] = Color(52, 152, 219),
- ["Midnight Blue"] = Color(44, 62, 80),
- ["Azure"] = Color(240,255,255),
- ["Pink"] = Color(255,122,142),
- ["Cyan"] = Color(0,255,255),
- ["Dark Blue"] = Color(0,0,139),
- ["Forest Green"] = Color(34,139,34),
- ["Turquoise"] = Color(26,188,156),
- ["Emerald"] = Color(46,204,113),
- ["Jade Sea"] = Color(22,160,133),
- ["Nephritis"] = Color(39,174,96),
- ["Peter River"] = Color(52,152,219),
- ["Belizehole"] = Color(41,128,185),
- ["Amethyst"] = Color(155,89,182),
- ["Wisteria"] = Color(142,68,173),
- ["Wetasphalt"] = Color(52,73,94),
- ["Sunflower"] = Color(241,196,15),
- ["Carrot"] = Color(230,126,34),
- ["Orange"] = Color(243,156,18),
- ["Pumpkin"] = Color(211,84,0),
- ["Alizarin"] = Color(231,76,60),
- ["Pomegrnate"] = Color(192,57,43),
- ["Silver"] = Color(189,195,199),
- ["Asbestos"] = Color(127,140,141),
- ["Concrete"] = Color(149,165,166),
- ["Crimson"] = Color(189,8,28),
- ["Scarlet"] = Color(255,36,0),
- ["Gold"] = Color(255,215,0),
- ["Bronze"] = Color(205,127,50)
- }
- ---------------------------------------------------------------------
- if SERVER then
- AddCSLuaFile("lib/sh_language.lua")
- include("lib/sh_language.lua")
- else
- include("lib/sh_language.lua")
- end
- CAR_DISPLAY_CONFIG.Language = "EN" --built in languages (EN = English, FR = French, RU = Russian) Need some more translations to do a few more phrases for
- -- If you're interested in hepling out send me a message on SF or Steam, thanks
- ---------------------------------------------------------------------------
- --------------------------------------------------------------------------
- --[[
- - How do I make the entities stay on server restart?
- My addon does not feature its own save feature, instead we use this feature which is prebuilt into Sandbox which DarkRP uses as a base.
- You position all of your entities in game and once positioned correctly. Open the context menu (Hold C),
- right click on the entity you want to keep and click "Make Persistent". This will make the "world" he owner of the entity now
- and will respawn next server restart.
- --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement