• DarkRP Vehicle Bug?
    9 replies, posted
darkrpmodification/lua/darkrp_customthings/vehicles.lua: DarkRP.createVehicle({     name = "hoverbike",     model = "models/hoverbike/hoverbike.mdl",     price = 0,     label = "Hoverbike",     modelScale = 1.25,     customCheck = function(ply)              end,     CustomCheckFailMsg = "", }) Error: gamemodes/darkrp/gamemode/libraries/simplerr.lua:530: [ERROR] A runtime error has occurred in "addons/darkrpmodification-master/lua/darkrp_customthings/vehicles.lua" on line 16. The best help I can give you is this: Vehicle invalid: hoverbike. Unknown vehicle name. Hints:     - No hints, sorry. The responsibility for the error above lies with (the authors of) one (or more) of these files:     1. addons/darkrpmodification-master/lua/darkrp_customthings/vehicles.lua on line 16     2. function 'xpcall'     3. gamemodes/darkrp/gamemode/libraries/simplerr.lua on line 477     4. gamemodes/darkrp/gamemode/libraries/fn.lua on line 84     5. gamemodes/darkrp/gamemode/libraries/fn.lua on line 84     6. gamemodes/darkrp/gamemode/libraries/modificationloader.lua on line 138     7. gamemodes/darkrp/gamemode/libraries/modificationloader.lua on line 149     8. gamemodes/darkrp/gamemode/init.lua on line 111 ------- End of Simplerr error ------- 8. hook.Call("DarkRPFinishedLoading", GM) 7. loadCustomDarkRPItems() 6. doInclude(File) 4. & 5. return a(b(...)) 3. local res = {xpcall(f, errorHandler, ...)} 2. xpcall 1. DarkRP.createVehicle({ Proof of entity name: https://i.imgur.com/BWQ9IpE.png https://i.imgur.com/aP6ErE7.png Copy pasted from clipboard: https://i.imgur.com/xy31OY3.png Not sure why the vehicles.lua table is checking xpcall either. But I'm filling out the vehicles template exactly as it should be but still receiving errors. I've also googled this issue and it seems a lot of people have had the same problem: [Help!] SCars Vehicle invalid DarkRP Are we all just idiots? lmao
DarkRP.createVehicle({ name = "hoverbike", model = "models/hoverbike/hoverbike.mdl", price = 0, label = "Hoverbike", modelScale = 1.25, customCheck = function(ply) end, CustomCheckFailMsg = "", })
yeah i meant read the line before the code ie "First, install your custom vehicle pack (if you're using one), then go in-game and type rp_getvehicles. It should print a list of available vehicles into your console. Choose the vehicle you would like to add, find its corresponding rp_getvehicles name, and keep it somewhere safe for the next step."
okay uhhh does it work with any of those other vehicles...?
testing it now
Bumping - As common sense dictates it's the vehicle from the workshop that's causing issues, I used someone else's vehicle from the workshop and it worked just fine. Would anyone be able to provide a tutorial on how to create a vehicle so that it's compatible with DarkRP. I can post code from the vehicle that doesn't work and the vehicle that does work if that would be of any help. I can tell they're similar but Obviously one takes into consideration far more.
Well, I looked into it and it turns out, that vehicles.lua executes sooner than hoverbike entity code(which does list.Set("Vehicles".. etc)), so at the moment vehicles.lua executes and you try to add hoverbike, hoverbike itself isn't registered in gmod. Here's the solution, just do this list.Set thing in the vehicles.lua list.Set("Vehicles","hoverbike",{ AdminOnly = false, Name = "Hoverbike", Class = "hoverbike", PrintName       = "Hoverbike", ClassName = "hoverbike", Category = "Half-Life 2", Information = "A REAL Hoverbike!", Model = "models/hoverbike/hoverbike.mdl", }) DarkRP.createVehicle({ name = "hoverbike", model = "models/hoverbike/hoverbike.mdl", price = 10, label = "Hoverbike", modelScale = 1.25, /*customCheck = function(ply) end,*/ CustomCheckFailMsg = "", }) I took that list.Set part from the addon itself. I guess addon makers should put all the list.Set things in lua/autorun, not into SENT/SWEP code.
Genius, thank you so much! I was going to go through the trouble of creating a vendor for the vehicle this saves me a bit of time <3
Sorry, you need to Log In to post a reply to this thread.