addMPEventHandler: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\|gr([0-9]+) = " to "|gr$1= ") |
Lou Montana (talk | contribs) m (Text replacement - "\|game([0-9]) ?= (.+) \|version([0-9]) ?= (.+) " to "|game$1= $2 |version$3= $4 ") |
||
Line 2: | Line 2: | ||
|game1= arma2oa | |game1= arma2oa | ||
|version1= 1.55 | |version1= 1.55 | ||
|game2= tkoh | |game2= tkoh | ||
|version2= 1.00 | |version2= 1.00 | ||
|game3= arma3 | |game3= arma3 | ||
|version3= 0.50 | |version3= 0.50 | ||
Revision as of 14:55, 3 May 2021
Description
- Description:
- Adds a multiplayer event handler (EH) to the given object and returns EH handle.
- Multiplayer:
- Multiplayer EHs are added globally to every client and the server and will fire on every client and server upon event. Only exception is the MPRespawn EH. That one only fires where the respawned unit is local. Make sure to check the locality of the EHs on EventHandlers List.
- Groups:
- MultiplayerEvent Handlers
Syntax
- Syntax:
- object addMPEventHandler [type, expression]
- Parameters:
- object: Object - Object to monitor
- type: String - Event handler name
- expression: String or Code - Expression to execute.
If EH has some data to return upon event (e.g. the "MPKilled" EH will return an array with 2 elements: the killed unit, and the killer), it is passed in _this variable. - Return Value:
- Number - Eventhandler index
Examples
- Example 1:
_index = player addMPEventHandler ["MPKilled", { _this execVM "playerKilled.sqf"; }];
Additional Information
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Categories:
- Scripting Commands
- Introduced with Arma 2: Operation Arrowhead version 1.55
- Arma 2: Operation Arrowhead: New Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Take On Helicopters: Scripting Commands
- Arma 3: Scripting Commands
- Command Group: Multiplayer
- Command Group: Event Handlers
- Scripting Commands: Global Effect