Arma 3 Scripting

addMPEventHandler

  • Global argument
  • Global effect
  • Arma 3 v0.50
  • First in Arma 2: Operation Arrowhead v1.55

Command · also in Event Handlers · Markdown · JSON · 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