Skip to content
M2O Scripting APIScripting reference
Runtime classClient APIGenerated

Vehicle

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

Client handle for a streamed M2O vehicle.

new Vehicle(id): Vehicle

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

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:1843

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:1849

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:1837

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:1855

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:1810

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:1831

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:1804

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:1817

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:1862

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:1824

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:1797

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:4033

Immutable network entity identifier.

Entity.id


readonly model: number

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

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


position: Vector3

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

Authoritative world-space position; assignment forces replicated state.

Entity.position


rotation: Vector3 | Quaternion

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

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:1791

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


readonly state: StateBag

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

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:4038

Current virtual-world identifier.

Entity.virtualWorld