Garry's Mod Wiki

Revision Difference

Structures/VehicleTable#552741

<cat>struct</cat>⤶ <structure> <realm>Shared</realm> <description> Table structure passed to <page>SANDBOX:PlayerSpawnVehicle</page>⤶ Table structure passed to <page>SANDBOX:PlayerSpawnVehicle</page>, 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"⤶ }⤶ } )⤶ ```⤶ </description> <fields> <item name="Author" type="string" default="VALVe"></item>⤶ <item name="Model" type="string" default="models/nova/jeep_seat.mdl"></item>⤶ <item name="Class" type="string" default="prop_vehicle_prisoner_pod"></item>⤶ <item name="Category" type="string" default="Chairs"></item>⤶ <item name="Information" type="string" default="A Seat from VALVe's Jeep"></item>⤶ <item name="Name" type="string" default="Jeep Seat"></item>⤶ <item name="KeyValues" type="table" default="{ ['vehiclescript'] = 'scripts/vehicles/prisoner_pod.txt' , ['limitview'] = 0}">⤶ <validate>Do any other values belong in the KeyValues table?</validate>⤶ <item name="Class" type="string">Entity class name for this vehicle.</item>⤶ <item name="Name" type="string" realm="client">Nice name for this vehicle, for UI purposes.</item>⤶ <item name="Model" type="string" realm="server">Model of the vehicle.</item>⤶ <item name="KeyValues" type="table" realm="server">A list of key-value pairs to apply to the vehicle entity.⤶ Possible valid keys that can be set are:⤶ * `vehiclescript`⤶ * `limitview`⤶ * `vehiclelocked`⤶ * `cargovisible`⤶ * `enablegun`⤶ </item> </fields>⤶ ⤶ <item name="Offset" type="number" default="nil" realm="server">Offset away the surface player is looking at to spawn at.</item>⤶ <item name="Members" type="table" default="nil" realm="server">Set these members on the spawned vehicle's table (<page>Entity:GetTable</page>) to given values.</item>⤶ <item name="Author" type="string" default="" realm="client">Author of the vehicle, for UI purposes.</item>⤶ <item name="Category" type="string" default="Other" realm="client">Category of this vehicle, for UI purposes.</item>⤶ <item name="Information" type="string" default="" realm="client">A small description of the vehicle, for UI purposes.</item>⤶ ⤶ </fields>⤶ </structure>