Arma 3 Scripting

Command in Multiplayer, Event Handlers

addMPEventHandler

Also available as Markdown and JSON, or read the original wiki page.

Description

Adds a multiplayer event handler (EH) to the given object and returns EH handle. See Event Handlers.

Important

A Multiplayer Event Handler is not saved in a save file and therefore will not be restored on load - use it accordingly.

Syntax

object addMPEventHandler [type, expression]

Parameters:

Returns: Number - event handler index

Examples

Example 1

_index = player addMPEventHandler ["MPKilled", { _this execVM "playerKilled.sqf"; }];

Multiplayer

Multiplayer EHs are added globally to every client and the server will fire on itself and every client upon event. The only exception is the MPRespawn EH that one only fires where the respawned unit is local. Make sure to check the EHs' locality in Event Handlers pages.

See also

removeMPEventHandler · removeAllMPEventHandlers · getEventHandlerInfo