Skip to content
M2O Scripting APIScripting reference
Runtime classServer APIGenerated

Prop

Defined in: server/api.d.ts:1342

Replicated static world object created from a Mafia II model.

new Prop(id): Prop

Defined in: server/api.d.ts:1347

Creates a script wrapper for an existing prop with this ID; use Prop.create() to create a prop.

number

Network entity identifier.

Prop

Entity.constructor

attachTo(target, offset?, rotation?): void

Defined in: server/api.d.ts:1405

Makes the prop follow a player or vehicle, stopping any moveTo. An attached prop has no collision and takes the target’s virtual world; it is released where it stands when the target is destroyed or disconnects.

number | Player | Vehicle

Player or vehicle to follow, or its network entity ID.

Vector3

Optional position relative to the target, in its local axes (X right, Y forward, Z up). Defaults to the origin.

Vector3 | Quaternion

Optional orientation relative to the target: a Quaternion, or a Vector3 of Euler angles in degrees.

void


destroy(): void

Defined in: server/api.d.ts:1378

Destroys this replicated prop and removes it from connected clients.

void


detach(): void

Defined in: server/api.d.ts:1388

Releases an attached prop, leaving it at its target’s current pose.

void


moveTo(position, durationMs, rotation?, easing?): void

Defined in: server/api.d.ts:1397

Glides the prop to a new pose, smoothly on every client, starting from where it is now. position and rotation report the destination at once; use isMoving to tell whether it has arrived. Throws while the prop is attached.

Vector3

World-space destination.

number

Travel time in milliseconds; 0 moves instantly. Capped at 10 minutes.

Vector3 | Quaternion

Optional final orientation: a Quaternion, or a Vector3 of Euler angles in degrees. Defaults to the current orientation.

"linear" | "inQuad" | "outQuad" | "inOutQuad"

Optional speed curve. Defaults to “linear”.

void


setVirtualWorld(world): void

Defined in: server/api.d.ts:4371

Moves this entity into another virtual world.

number

Virtual-world identifier used to partition replication and visibility.

void

Entity.setVirtualWorld


setVisibleTo(player): void

Defined in: server/api.d.ts:4377

Restricts replication of this entity to one owning connection while preserving normal range and visibility checks.

Entity | null

Player-owned entity whose connection should exclusively receive this entity, or null to clear the restriction.

void

Entity.setVisibleTo


stop(): void

Defined in: server/api.d.ts:1383

Halts a running moveTo where the prop is now.

void


toString(): string

Defined in: server/api.d.ts:1373

Returns a readable representation of this prop.

string

The prop ID formatted for logging or debugging.

Entity.toString


static create(x, y, z, model, rotation?, collision?, virtualWorld?): Prop

Defined in: server/api.d.ts:1418

Creates and replicates a static world prop.

number

Initial world-space X coordinate.

number

Initial world-space Y coordinate.

number

Initial world-space Z coordinate.

number

Mafia II model identifier to instantiate.

Vector3 | Quaternion

Optional orientation: a Quaternion, or a Vector3 of Euler angles in degrees.

boolean

Optional solidity; pass false to spawn a pass-through prop with no collision. Defaults to true.

number

Optional virtual-world ID used for visibility filtering.

Prop

The newly created prop handle.

readonly attachedTo: number

Defined in: server/api.d.ts:1357

Network entity ID of the player or vehicle this prop follows; 0 when it is free.


collision: boolean

Defined in: server/api.d.ts:1367

Whether the prop is solid. Set false to make it pass-through for players, vehicles and physics.


readonly id: number

Defined in: server/api.d.ts:4339

Immutable network entity identifier.

Entity.id


readonly isMoving: boolean

Defined in: server/api.d.ts:1352

Whether a moveTo is still under way.


readonly model: number

Defined in: server/api.d.ts:1362

Mafia II model identifier used by this prop.


position: Vector3

Defined in: server/api.d.ts:4349

Authoritative world-space position; assignment forces replicated state.

Entity.position


rotation: Vector3 | Quaternion

Defined in: server/api.d.ts:4354

Authoritative rotation; reads return a quaternion and assignments accept a quaternion or Euler angles in degrees.

Entity.rotation


readonly state: StateBag

Defined in: server/api.d.ts:4359

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: server/api.d.ts:4344

Current virtual-world identifier.

Entity.virtualWorld