Adding vehicles to the vehicles tab.

These used to be stored in txt files in the settings folder, but I think garry changed the way the spawn menu works a while back and now this method doesn’t work anymore. Does anyone know how to add vehicles to the current spawn menu?

I’m pretty sure you have to use list.Set(), a clientside Lua function. Here’s an example from 1/4 Life.
[lua]
local V = {
Name = “FSD Overrun”,
Class = “prop_vehicle_prisoner_pod”,
Category = Category,

			Author = "PhoeniX-Storms",
			Information = "FSD Overrun Monorail",
			Model = "models/props_phx/trains/fsd-overrun2.mdl",
			KeyValues = {
							vehiclescript	=	"scripts/vehicles/prisoner_pod.txt",
							limitview		=	"0"
						},
			Members = {
							HandleAnimation = HandlePHXVehicleAnimation,
						}

}

list.Set( “Vehicles”, “phx_train”, V )
[/lua]
In the above code, V is simply a table containing information about the vehicle. “Vehicles” in list.Set() is a constant pointing towards the vehicles tab of the spawn menu. “phx_train” is the vehicle class name. I believe it’s set by this line, you don’t have to look it up.

This must be done in a clientside or shared script. An easy way of quickly adding a vehicle would be creating a script in lua/autorun/client/, naming it anything, and using the above code as a template for adding your own vehicle.

Remember that this will only add a spawn button to your own menu, players who join your server won’t automatically see the button unless they are forced to download this script through AddCSLuaFile() or resource.AddFile().

Thanks a lot.