Vehicle
Defined in: client/api.d.ts:1675
Client handle for a streamed M2O vehicle.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Vehicle(
id):Vehicle
Defined in: client/api.d.ts:1680
Creates a script wrapper for an existing streamed vehicle with this ID; it does not spawn a vehicle.
Parameters
Section titled “Parameters”number
Network entity identifier.
Returns
Section titled “Returns”Vehicle
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”getColor()
Section titled “getColor()”getColor():
number
Defined in: client/api.d.ts:1742
Returns the primary paint this client is rendering, factory or scripted.
Returns
Section titled “Returns”number
Packed 0x00RRGGBB, or -1 when the vehicle is not streamed in.
getColorSecondary()
Section titled “getColorSecondary()”getColorSecondary():
number
Defined in: client/api.d.ts:1748
Returns the secondary paint this client is rendering, factory or scripted.
Returns
Section titled “Returns”number
Packed 0x00RRGGBB, or -1 when the vehicle is not streamed in.
getDroppedParts()
Section titled “getDroppedParts()”getDroppedParts():
number[]
Defined in: client/api.d.ts:1736
Lists the deform parts torn off this vehicle on this client.
Returns
Section titled “Returns”number[]
Indices of the missing parts.
getLightCount()
Section titled “getLightCount()”getLightCount():
number
Defined in: client/api.d.ts:1754
Returns how many headlights this vehicle’s model has.
Returns
Section titled “Returns”number
The headlight count, or 0 when the vehicle is not streamed in.
getPartCount()
Section titled “getPartCount()”getPartCount():
number
Defined in: client/api.d.ts:1709
Returns how many deform parts this vehicle’s model has.
Returns
Section titled “Returns”number
The part count, or 0 when the vehicle is not streamed in.
getPartStage()
Section titled “getPartStage()”getPartStage(
index):number
Defined in: client/api.d.ts:1730
Returns the damage stage one deform part is currently showing.
Parameters
Section titled “Parameters”number
Model-specific deform-part index.
Returns
Section titled “Returns”number
The damage stage, 0 when undamaged.
getPartTransform()
Section titled “getPartTransform()”getPartTransform(
partId):BoneTransform|null
Defined in: client/api.d.ts:1703
Resolves the current world-space transform of a named vehicle part.
Parameters
Section titled “Parameters”partId
Section titled “partId”number
Numeric part identifier, typically obtained from the global VehiclePart table.
Returns
Section titled “Returns”BoneTransform | null
The part transform, or null when the vehicle or requested part is unavailable.
getPartType()
Section titled “getPartType()”getPartType(
index):number
Defined in: client/api.d.ts:1716
Returns the native type of one deform part.
Parameters
Section titled “Parameters”number
Model-specific deform-part index.
Returns
Section titled “Returns”number
A numeric part type, or -1 when the index or vehicle is unavailable.
isLightBroken()
Section titled “isLightBroken()”isLightBroken(
index):boolean
Defined in: client/api.d.ts:1761
Checks whether one headlight is smashed on this client.
Parameters
Section titled “Parameters”number
Headlight index.
Returns
Section titled “Returns”boolean
True when the headlight is broken.
isPartDropped()
Section titled “isPartDropped()”isPartDropped(
index):boolean
Defined in: client/api.d.ts:1723
Checks whether one deform part is torn off on this client.
Parameters
Section titled “Parameters”number
Model-specific deform-part index.
Returns
Section titled “Returns”boolean
True when the part is missing.
toString()
Section titled “toString()”toString():
string
Defined in: client/api.d.ts:1696
Returns a readable representation of this vehicle handle.
Returns
Section titled “Returns”string
The vehicle ID formatted for logging or debugging.
Inherited from
Section titled “Inherited from”Properties
Section titled “Properties”
readonlyid:number
Defined in: client/api.d.ts:3926
Immutable network entity identifier.
Inherited from
Section titled “Inherited from”
readonlymodel:number
Defined in: client/api.d.ts:1685
Mafia II vehicle model identifier, as replicated from the server.
position
Section titled “position”position:
Vector3
Defined in: client/api.d.ts:3936
Authoritative world-space position; assignment forces replicated state.
Inherited from
Section titled “Inherited from”rotation
Section titled “rotation”rotation:
Vector3|Quaternion
Defined in: client/api.d.ts:3941
Authoritative rotation; reads return a quaternion and assignments accept a quaternion or Euler angles in degrees.
Inherited from
Section titled “Inherited from”seatCount
Section titled “seatCount”
readonlyseatCount:number
Defined in: client/api.d.ts:1690
Native seat count of the streamed car, 0 when it is not streamed in.
readonlystate:StateBag
Defined in: client/api.d.ts:3946
Arbitrary key/value state carried by this entity. The server writes it and every client that can see the entity receives it; see StateBag.
Inherited from
Section titled “Inherited from”virtualWorld
Section titled “virtualWorld”
readonlyvirtualWorld:number
Defined in: client/api.d.ts:3931
Current virtual-world identifier.
