Garry's Mod Wiki

Vehicle:GetVehicleClass

  string Vehicle:GetVehicleClass()

Description

Returns the vehicle class name. This is only useful for Sandbox spawned vehicles or any vehicle that properly sets the vehicle class with Vehicle:SetVehicleClass.

Returns

1 string
The class name of the vehicle.

Example

Prints the spawn menu name of the vehicle the player is currently in.

local c = Entity(1):GetVehicle():GetVehicleClass() if ( !list.Get( "Vehicles" )[ c ] ) then return end local t = list.Get( "Vehicles" )[ c ] print( t.Name )