Skip to content
M2O Scripting APIScripting reference
Global objectClient APIGenerated

Ui

const Ui: object

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

Mafia II’s own interactive prompts, driven locally. Each call takes a caller-defined id that the resulting client event echoes back, so several prompts can be told apart.

cancelLockpick(): void

Closes the active lockpicking minigame, reported as escaped.

void

cancelQuestion(): void

Closes the active question or dialog without raising an answer event.

void

showDialog(questionId, title, acceptLabel, declineLabel, timeoutSeconds?): void

Shows a native two-choice confirmation dialog. The result arrives as the dialogAnswer event.

number

Opaque caller-defined ID echoed by the dialogAnswer event.

string

Dialog question or title text.

string

Label for the accepting option.

string

Label for the declining option.

number

Time before the dialog is dismissed automatically; defaults to 10, and zero or less disables the timeout.

void

showQuestion(questionId, question, answers, timeoutSeconds?): void

Shows the native multiple-choice question UI. The result arrives as the questionAnswer event with a one-based answer index, or -1 when the prompt timed out or was dismissed.

number

Opaque caller-defined ID echoed by the questionAnswer event.

string

Question text shown to the player.

string[]

One to four answer labels; entries beyond the fourth are ignored.

number

Time before the prompt is dismissed automatically; defaults to 10, and zero or less disables the timeout.

void

startLockpick(lockpickId, pins?, maxFails?): void

Starts the native lockpicking minigame. Completion, failure, or escape arrives as the lockpickResult event. Movement is locked while it runs on foot, because the tension wrench rides the move axis.

number

Opaque caller-defined ID echoed by the lockpickResult event.

number

Difficulty from 1 through 5 pins; defaults to 4.

number

Allowed broken pins before failure; zero or less, the default, means unlimited attempts.

void