Page tree
Skip to end of metadata
Go to start of metadata



Introduced in

Version:2.00

Description

Description:

Executes the defined action on all attached multiplayer (MP) clients.

This command can only be used in Multiplayer. If the player unit is passed to the command, a local player appears on each separate machine.

When defining actions for MP events, the code string should be kept as brief as possible, in order to keep network traffic low. If complex actions are required, it is better to call a script or a function from the event handler instead.

Syntax

Syntax:unit addMPEventHandler [event, action];
Parameters:
  • unit: Object - Unit the event handler is attached to.
  • event: String - A Multiplayer event.
  • action: String or Code - Code to execute (on all machines), when the event fires.
Return Value:Number - Event handler index, to use in removeMPEventHandler.

Examples

Examples:
 _EHidx = player addMPEventHandler ["MPKilled", "nul = [_this] execVM 'playerkilled.sqf'"]

Additional Information

See also: removeMPEventHandler, removeAllMPEventHandlers, addEventHandler
Multiplayer: 
Problems: 

Notes