Skip to content
M2O Scripting APIScripting reference
Runtime classClient APIGenerated

Vehicle

Defined in: client/api.d.ts:1675

Client handle for a streamed M2O vehicle.

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.

number

Network entity identifier.

Vehicle

Entity.constructor

getColor(): number

Defined in: client/api.d.ts:1742

Returns the primary paint this client is rendering, factory or scripted.

number

Packed 0x00RRGGBB, or -1 when the vehicle is not streamed in.


getColorSecondary(): number

Defined in: client/api.d.ts:1748

Returns the secondary paint this client is rendering, factory or scripted.

number

Packed 0x00RRGGBB, or -1 when the vehicle is not streamed in.


getDroppedParts(): number[]

Defined in: client/api.d.ts:1736

Lists the deform parts torn off this vehicle on this client.

number[]

Indices of the missing parts.


getLightCount(): number

Defined in: client/api.d.ts:1754

Returns how many headlights this vehicle’s model has.

number

The headlight count, or 0 when the vehicle is not streamed in.


getPartCount(): number

Defined in: client/api.d.ts:1709

Returns how many deform parts this vehicle’s model has.

number

The part count, or 0 when the vehicle is not streamed in.


getPartStage(index): number

Defined in: client/api.d.ts:1730

Returns the damage stage one deform part is currently showing.

number

Model-specific deform-part index.

number

The damage stage, 0 when undamaged.


getPartTransform(partId): BoneTransform | null

Defined in: client/api.d.ts:1703

Resolves the current world-space transform of a named vehicle part.

number

Numeric part identifier, typically obtained from the global VehiclePart table.

BoneTransform | null

The part transform, or null when the vehicle or requested part is unavailable.


getPartType(index): number

Defined in: client/api.d.ts:1716

Returns the native type of one deform part.

number

Model-specific deform-part index.

number

A numeric part type, or -1 when the index or vehicle is unavailable.


isLightBroken(index): boolean

Defined in: client/api.d.ts:1761

Checks whether one headlight is smashed on this client.

number

Headlight index.

boolean

True when the headlight is broken.


isPartDropped(index): boolean

Defined in: client/api.d.ts:1723

Checks whether one deform part is torn off on this client.

number

Model-specific deform-part index.

boolean

True when the part is missing.


toString(): string

Defined in: client/api.d.ts:1696

Returns a readable representation of this vehicle handle.

string

The vehicle ID formatted for logging or debugging.

Entity.toString

readonly id: number

Defined in: client/api.d.ts:3926

Immutable network entity identifier.

Entity.id


readonly model: number

Defined in: client/api.d.ts:1685

Mafia II vehicle model identifier, as replicated from the server.


position: Vector3

Defined in: client/api.d.ts:3936

Authoritative world-space position; assignment forces replicated state.

Entity.position


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.

Entity.rotation


readonly seatCount: number

Defined in: client/api.d.ts:1690

Native seat count of the streamed car, 0 when it is not streamed in.


readonly state: 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.

Entity.state


readonly virtualWorld: number

Defined in: client/api.d.ts:3931

Current virtual-world identifier.

Entity.virtualWorld