Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.57 KB | None | 0 0
  1.  
  2.  
  3. [ERROR] addons/car-display/lua/entities/ent_carpad/cl_init.lua:55: attempt to index field 'Selected' (a nil value)
  4. 1. Draw - addons/car-display/lua/entities/ent_carpad/cl_init.lua:55
  5. 2. unknown - addons/car-display/lua/entities/ent_carpad/cl_init.lua:49
  6.  
  7. -- CONFIG IS BELOW THIS --
  8. ----------------------------------------------------------------------
  9.  
  10. local function AddVehicle(name, price, class, customcheck, cl_scale, base, tags)
  11. if type(name) == "string" then
  12.  
  13. local veh = list.Get("Vehicles")[class]
  14. if veh == nil then
  15. table.insert(CAR_DISPLAY_CONFIG.FailedVehicles, {
  16. ["name"] = name,
  17. ["price"] = price,
  18. ["class"] = class,
  19. ["tags"] = tags,
  20. ["base"] = base,
  21. ["trace"] = debug.traceback()
  22. })
  23. return
  24. end
  25.  
  26. local index = table.insert(CAR_DISPLAY_CONFIG.Vehicles, {
  27. ["name"] = name,
  28. ["price"] = price,
  29. ["model"] = veh.Model,
  30. ["script"] = veh.KeyValues.vehiclescript,
  31. ["class"] = class,
  32. ["basetype"] = base || "prop_vehicle_jeep",
  33. ["cl_scale"] = cl_scale || .9,
  34. ["customcheck"] = customcheck || function() return true end,
  35. ["allowed_bodygroups"] = {},
  36. ["allowed_colors"] = {},
  37. ["tags"] = tags
  38. })
  39. CAR_DISPLAY_CONFIG.Vehicles[index]["index"] = index
  40.  
  41. elseif type(name) == "table" then
  42.  
  43. local tbl = name
  44. local veh = list.Get("Vehicles")[tbl.class]
  45. tbl.customcheck = tbl.customcheck || function() return true end
  46. if veh == nil then
  47. table.insert(CAR_DISPLAY_CONFIG.FailedVehicles, {
  48. ["name"] = name,
  49. ["price"] = price,
  50. ["class"] = class,
  51. ["tags"] = tags,
  52. ["base"] = base,
  53. ["trace"] = debug.traceback()
  54. })
  55. return
  56. end
  57. local index = table.insert(CAR_DISPLAY_CONFIG.Vehicles, {
  58. ["name"] = tbl.name,
  59. ["price"] = tbl.price,
  60. ["model"] = veh.Model,
  61. ["script"] = veh.KeyValues.vehiclescript,
  62. ["class"] = tbl.class,
  63. ["basetype"] = tbl.base || "prop_vehicle_jeep",
  64. ["cl_scale"] = tbl.cl_scale || .9,
  65. ["customfailmessage"] = tbl.customfailmessage || "You cannot purchase this vehicle!",
  66. ["customcheck"] = function(ply) return tbl.customcheck(ply), tbl.customfailmessage end,
  67. ["tags"] = tbl.tags,
  68. ["allowed_bodygroups"] = tbl.allowed_bodygroups || {},
  69. ["allowed_colors"] = tbl.allowed_colors || {}
  70. })
  71. CAR_DISPLAY_CONFIG.Vehicles[index]["index"] = index
  72.  
  73. end
  74. end
  75.  
  76. ----------------------------------------------------------------------
  77.  
  78. -- Add your custom vehicles below as follows:
  79. -- <Display Name> : This shows up on all the screens when players are browsing cars
  80. -- <Price> : The price the player pays for the car
  81. -- <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)
  82. -- <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
  83. -- <Model Scale> <Optional> : Size of the model being displayed on the car pad
  84. -- <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
  85. -- <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"}
  86. -- <Allowed Bodygroups> <Optional> : Allowed Bodygroups that can be customised on the car
  87. -- <Allowed Colours> <Optional> : Allowed Colours that can be applied to the car
  88. -- Examples below
  89.  
  90. --[[
  91. AddVehicle({
  92. name = "Jeep - HL2",
  93. price = 150000,
  94. class = "Jeep",
  95. customfailmessage = "You are not a donator!",
  96. customcheck = function(ply) return table.HasValue(ply:GetUserGroup(), {"VIP", "Donator"}),
  97. cl_scale = .2,
  98. base = "prop_vehicle_jeep",
  99. tags = {"Sports"},
  100. allowed_bodygroups = {
  101. ["wing"] = true
  102. },
  103. allowed_colors = {
  104. ["Emerald"] = true,
  105. ["Dark Blue"] = true,
  106. ["Wetasphalt"] = true,
  107. }
  108. })
  109. ]]--
  110. ----------------------------------------------------------------------
  111. function CarDisplay_LoadConfig()
  112.  
  113. -- Example Vehicles, all default to gmod :)
  114. --[[
  115. Generated using: DarkRP | Vehicle Generator
  116. https://csite.io/tools/gmod-darkrp-vehicle
  117. --]]
  118. DarkRP.createVehicle({
  119. name = "Audi R8",
  120. model = "audir8tdm",
  121. price = 500000,
  122. label = "Audi R8",
  123. category = "sport"
  124. })
  125. DarkRP.createVehicle({
  126. name = "Audi R8 GT Spyder",
  127. model = "audir8spydtdm",
  128. price = 700000,
  129. label = "Audi R8 GT Spyder",
  130. category = "sport"
  131. })
  132. DarkRP.createVehicle({
  133. name = "Audi R8 Plus",
  134. model = "audir8plustdm",
  135. price = 1000000,
  136. label = "Audi R8 Plus",
  137. category = "sport"
  138. })
  139. DarkRP.createVehicle({
  140. name = "Bugstti EB110",
  141. model = "eb110tdm",
  142. price = 3000000,
  143. label = "Bugatti EB 110",
  144. category = "super"
  145. })
  146. DarkRP.createVehicle({
  147. name = "Bugstti Veyron",
  148. model = "veyrontdm",
  149. price = 4000000,
  150. label = "Bugatti Veyron",
  151. category = "super"
  152. })
  153. DarkRP.createVehicle({
  154. name = "Bugstti Veyron SS",
  155. model = "veyronsstdm",
  156. price = 5500000,
  157. label = "Bugatti Veyron SS",
  158. category = "super"
  159. })
  160. -- USE THIS FOR TESTING ALL YOUR SERVERS CARS (May not function on some servers)
  161. --[[for k,v in pairs(list.Get("Vehicles")) do
  162. AddVehicle(v.Name, 1000, k, function() return true end, 1, v.Class)
  163. end--]]
  164. end
  165. ------------------------------------------------------------------------
  166.  
  167. CAR_DISPLAY_CONFIG.SellPercent = .2 -- Percent of the cars value that should be given back to the player when they sell it.
  168. CAR_DISPLAY_CONFIG.BuyPercent = .1 -- Percent of the cars original value should be charged when they want to change the colour or bodygroups
  169. CAR_DISPLAY_CONFIG.MaxSpawnedVehicles = 2 -- The max allowed vehicles a player is allowed out at any one time.
  170.  
  171. ------------------------------------------------------------------------
  172.  
  173. CAR_DISPLAY_CONFIG.CarColors = { // Default Car Colours
  174. ["Red"] = Color(255,0,0),
  175. ["White"] = Color(255,255,255),
  176. ["Blue"] = Color(0,0,255),
  177. ["Green"] = Color(0,255,0),
  178. ["Grey"] = Color(120,120,120),
  179. ["Black-Grey"] = Color(32,32,32),
  180. ["Black"] = Color(0,0,0),
  181. ["Yellow"] = Color(241,196,15),
  182. ["Light Blue"] = Color(52, 152, 219),
  183. ["Midnight Blue"] = Color(44, 62, 80),
  184. ["Azure"] = Color(240,255,255),
  185. ["Pink"] = Color(255,122,142),
  186. ["Cyan"] = Color(0,255,255),
  187. ["Dark Blue"] = Color(0,0,139),
  188. ["Forest Green"] = Color(34,139,34),
  189. ["Turquoise"] = Color(26,188,156),
  190. ["Emerald"] = Color(46,204,113),
  191. ["Jade Sea"] = Color(22,160,133),
  192. ["Nephritis"] = Color(39,174,96),
  193. ["Peter River"] = Color(52,152,219),
  194. ["Belizehole"] = Color(41,128,185),
  195. ["Amethyst"] = Color(155,89,182),
  196. ["Wisteria"] = Color(142,68,173),
  197. ["Wetasphalt"] = Color(52,73,94),
  198. ["Sunflower"] = Color(241,196,15),
  199. ["Carrot"] = Color(230,126,34),
  200. ["Orange"] = Color(243,156,18),
  201. ["Pumpkin"] = Color(211,84,0),
  202. ["Alizarin"] = Color(231,76,60),
  203. ["Pomegrnate"] = Color(192,57,43),
  204. ["Silver"] = Color(189,195,199),
  205. ["Asbestos"] = Color(127,140,141),
  206. ["Concrete"] = Color(149,165,166),
  207. ["Crimson"] = Color(189,8,28),
  208. ["Scarlet"] = Color(255,36,0),
  209. ["Gold"] = Color(255,215,0),
  210. ["Bronze"] = Color(205,127,50)
  211. }
  212.  
  213. ---------------------------------------------------------------------
  214. if SERVER then
  215. AddCSLuaFile("lib/sh_language.lua")
  216. include("lib/sh_language.lua")
  217. else
  218. include("lib/sh_language.lua")
  219. end
  220.  
  221. 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
  222. -- If you're interested in hepling out send me a message on SF or Steam, thanks
  223.  
  224.  
  225. ---------------------------------------------------------------------------
  226.  
  227. --------------------------------------------------------------------------
  228. --[[
  229. - How do I make the entities stay on server restart?
  230.  
  231. 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.
  232. You position all of your entities in game and once positioned correctly. Open the context menu (Hold C),
  233. right click on the entity you want to keep and click "Make Persistent". This will make the "world" he owner of the entity now
  234. and will respawn next server restart.
  235. --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement