Garry's Mod Wiki

VehicleTable

Description

Table structure passed to SANDBOX:PlayerSpawnVehicle, describing a spawnable Vehicle in Sandbox gamemode.

Example usage in defined a custom spawnable vehicle:

list.Set( "Vehicles", "Jeep", { -- Required information Name = "Jeep", Model = "models/buggy.mdl", Class = "prop_vehicle_jeep_old", Category = "Half-Life 2", -- Optional information Author = "VALVe", Information = "The regular old jeep", KeyValues = { vehiclescript = "scripts/vehicles/jeep_test.txt" } } )

Members

string Class
Entity class name for this vehicle.
string Name
Nice name for this vehicle, for UI purposes.
string Model
Model of the vehicle.
table KeyValues
A list of key-value pairs to apply to the vehicle entity. Possible valid keys that can be set are:
Key Description
vehiclescript The vehicle script files contained in scripts\vehicles\ define the behaviour and handling of a vehicle.
limitview Limit vertical view of the vehicles to +/-70 degrees (90 for unlimited)
vehiclelocked Players cannot enter vehicle until it is unlocked.
cargovisible Is the Magnusson cargo hopper visible?
EnableGun Whether the Tau Cannon is enabled or disabled. Doesn't work correctly with the Episode Two jalopy model.
NoHazardLights Stops the jalopy's hazard lights from turning on and flashing when the player exits the vehicle.
number Offset
Offset away the surface player is looking at to spawn at.

Default: nil

table Members
Set these members on the spawned vehicle's table (Entity:GetTable) to given values.

Default: nil

string Author
Author of the vehicle, for UI purposes.

Default: ""

string Category
Category of this vehicle, for UI purposes.

Default: "Other"

string Information
A small description of the vehicle, for UI purposes.

Default: ""