Skip to content
M2O Scripting APIScripting reference
Data shapeClient APIGenerated

EventMap

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

Native events dispatched through Events.on. Each property is the exact callback argument tuple for that event.

chatMessage: [ChatMessageEvent]

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

Dispatched when the client receives a framework chat-message RPC, before the built-in chat overlay is updated.


chatSend: [string]

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

Dispatched synchronously when the local player submits a chat line, before it is sent. Return false to keep the line client-side; async handlers cannot block it. Not dispatched for Chat.send.


cityPartChanged: [CityPartChangeEvent]

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

Dispatched when the local player crosses into a different city district.


dialogAnswer: [QuestionAnswerEvent]

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

Dispatched when a prompt shown by Ui.showDialog resolves. answerId is 1 for the accepting option and 2 for the declining one.


lockpickResult: [LockpickResultEvent]

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

Dispatched when a minigame started by Ui.startLockpick ends, including when Ui.cancelLockpick closes it.


playerDamage: [PlayerDamageEvent]

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

Dispatched immediately after the local player receives native damage.


questionAnswer: [QuestionAnswerEvent]

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

Dispatched when a prompt shown by Ui.showQuestion resolves. Not dispatched for Ui.showDialog, which raises dialogAnswer, nor for a prompt closed by Ui.cancelQuestion.


radioPowerChange: [RadioPowerChangeEvent]

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

Dispatched after the local player’s vehicle radio is turned on or off.


radioStationChange: [RadioStationChangeEvent]

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

Dispatched after the local player’s vehicle radio changes station.


resourceStart: [string]

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

Dispatched after a resource entry point has run and immediately before the resource becomes running.


resourceStop: [string]

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

Dispatched while a resource is stopping, before its stop callback, timers, exports, and event handlers are cleaned up.


shopOpen: [ShopOpenEvent]

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

Dispatched synchronously before Mafia II’s native shop menu opens. Return false to suppress it entirely: no menu is drawn and no shop camera transition starts, which is what replacing the shop with a custom interface needs. Async handlers cannot block it. The server still receives playerShopEnter.