# Multiplayer (scripting commands)

- [addMPEventHandler](../../commands/addMPEventHandler.md): Adds a multiplayer event handler (EH) to the given object and returns EH handle. See Event Handlers.
- [addPlayerScores](../../commands/addPlayerScores.md): MP server only: Adds player score.
- [addPublicVariableEventHandler](../../commands/addPublicVariableEventHandler.md) **[broken]**: This event handler will detect if a missionNamespace variable (it is attached to) has been broadcast over network with publicVariable, publicVariableClient or publicVariableServer commands and will execute EH code upon…
- [addScore](../../commands/addScore.md): Adds a number to the score of a unit. Negative values will remove from the score.
- [addScoreSide](../../commands/addScoreSide.md): Adds side score. This is shown in the MP score tab as the total score. MP only.
- [admin](../../commands/admin.md): This is dedicated server command, which queries the admin state of any client on the network by their client (owner) id.
- [allPlayers](../../commands/allPlayers.md): Returns a list of all units controlled by connected clients. This includes: - Normal human players (including dead players) - Virtual Entities (see *Systems* → *Logic Entities* → *Virtual Entities* in the Eden Editor) -…
- [allUsers](../../commands/allUsers.md): Returns a list of player ids of all the users on an MP server.
- [clientOwner](../../commands/clientOwner.md): Returns the machine network ID of the client executing the command.
- [didJIP](../../commands/didJIP.md): Checks if the current client Joined In Progress.
- [didJIPOwner](../../commands/didJIPOwner.md): Checks if the current owner of supplied Object Joined In Progress. Returns false on clients.
- [disableRemoteSensors](../../commands/disableRemoteSensors.md): This command will halt raycasting calculations (on the local machine only) for all groups which don't contain *any* local entities.
- [estimatedEndServerTime](../../commands/estimatedEndServerTime.md): Estimated end of MP game in seconds converted to serverTime.
- [estimatedTimeLeft](../../commands/estimatedTimeLeft.md): Sets the estimated time left in the game that is shown in the "Game in progress" screen or in the master browser.
- [exportJIPMessages](../../commands/exportJIPMessages.md): Creates a log file containing an overview on all JIP (network) messages currently in the JIP queue. The file is created in the same directory as .rpt file.
- [forceRespawn](../../commands/forceRespawn.md): Forces the unit to respawn. The effect is as if the player pressed the RESPAWN button in the game pause menu; the unit is killed but there is no "X was killed" message and no score adjustment.
- [getClientState](../../commands/getClientState.md): Returns client state in network game. Works on both, client and dedicated server. The following states are possible:
- [getClientStateNumber](../../commands/getClientStateNumber.md): Returns client state in network game. Works on both, client and dedicated server. The following states are possible:
- [getPlayerID](../../commands/getPlayerID.md): Returns user DirectPlay ID, which can be used with getUserInfo, and is found in allMapMarkers results and in some mission event handlers such as PlayerConnected.
- [getPlayerScores](../../commands/getPlayerScores.md): Returns the unit's table of scores (infantry kills, soft vehicle kills, armor kills, air kills, deaths, total score) in multiplayer or an empty array in singleplayer.
- [getPlayerUID](../../commands/getPlayerUID.md): Return a UniqueID of the given unit (player).
- [getRespawnVehicleInfo](../../commands/getRespawnVehicleInfo.md): Returns various properties for the respawning vehicle (see Vehicle Respawn). All properties are synched over the network and should be the same on every client including JIP.
- [getServerInfo](../../commands/getServerInfo.md): Get the current server instance's settings from server config.
- [getUserInfo](../../commands/getUserInfo.md): Returns extended information about given server user.
- [getVariable](../../commands/getVariable.md): Returns the value of variable in the variable space assigned to various data types. All available data types combinations:
- [groupFromNetId](../../commands/groupFromNetId.md): Get group from the provided unique ID. For objects, use objectFromNetId.
- [groupOwner](../../commands/groupOwner.md): Returns the machine network ID of the client to which the group is local. This command only works when called from the server. When called from a client, it always returns 0.
- [hasInterface](../../commands/hasInterface.md): Returns true if the computer has an interface (a real player). False for a dedicated server or for a headless client.
- [hostMission](../../commands/hostMission.md): Host the multiplayer mission defined in the config class and opens the lobby with the scenario loaded. Must be called in UI action from a dialog.
- [isDedicated](../../commands/isDedicated.md): Returns true if the machine executing the command is a dedicated multiplayer server. Returns false in single player.
- [isMultiplayer](../../commands/isMultiplayer.md): Return true if multiPlayer.
- [isMultiplayerSolo](../../commands/isMultiplayerSolo.md): Returns true when playing a game in solo multiplayer (for example Apex coop campaign PLAY SOLO option).
- [isPlayer](../../commands/isPlayer.md): Checks if given person is a player. Returns true for headless clients as well.
- [isRemoteExecuted](../../commands/isRemoteExecuted.md): Returns true if the code context is being remote executed by remoteExec or remoteExecCall. In SP always returns false. See also isRemoteExecutedJIP:
- [isRemoteExecutedJIP](../../commands/isRemoteExecutedJIP.md): Returns true if the code context is being remote executed from the JIP queue by remoteExec or remoteExecCall (when JIP param was set). It is a subset of isRemoteExecuted:
- [isServer](../../commands/isServer.md): Returns true if the machine executing the command is the server in a multiplayer game or is running single player. It will return true for both dedicated and player-hosted server. See also Multiplayer Scripting/machines.
- [local](../../commands/local.md): Check if given unit is local on the computer in multiplayer games - see Multiplayer Scripting#Locality.
- [localNamespace](../../commands/localNamespace.md): Returns local Namespace attached to the mission. Has the same lifetime as missionNamespace but variables cannot be broadcasted out of or into this namespace in multiplayer and will not be serialized when game is saved.
- [logNetwork](../../commands/logNetwork.md): Registers new log file recording a network traffic and returns handle of the log. The log file is saved inside the Arma 3 root folder.
- [logNetworkTerminate](../../commands/logNetworkTerminate.md): Terminates a network log file started with logNetwork with the given handle
- [netId](../../commands/netId.md): Get the unique ID of an object or a group.
- [objectFromNetId](../../commands/objectFromNetId.md): Get object with given unique ID. For groups, use groupFromNetId.
- [onPlayerConnected](../../commands/onPlayerConnected.md): This command will execute the provided code on the server whenever a player connects to a multiplayer session.
- [onPlayerDisconnected](../../commands/onPlayerDisconnected.md): This command will execute attached code whenever a player is leaving an MP session. The code will receive a number of special variables:
- [owner](../../commands/owner.md): On server machine, returns the machine network ID of the client to which the object is local. Otherwise returns 0. For use on clients clientOwner command is available. To find out the owner of a Group, use groupOwner.
- [playableSlotsNumber](../../commands/playableSlotsNumber.md): Returns the number of available slots in mission per side (both empty and taken). In singleplayer mission, it returns number of playable units per side.
- [playableUnits](../../commands/playableUnits.md): Returns a list of playable units in a multiplayer game (occupied by both AI or players), created on the following sides east/opfor, west/blufor, resistance/independent and civilian only.
- [playerRespawnTime](../../commands/playerRespawnTime.md): Return the player's remaining time before respawn, or -1 if it is not available (such as when the player is alive).
- [playersNumber](../../commands/playersNumber.md): Returns count of occupied role selection slots for given side. Players who claimed a slot in the lobby but did not start the mission are counted as well.
- [publicVariable](../../commands/publicVariable.md): Reliably broadcasts missionNamespace variable and its current value to all computers (server/client).
- [publicVariableClient](../../commands/publicVariableClient.md): Send the variable value to the client computer - same limitations regarding variable type as publicVariable.
- [publicVariableServer](../../commands/publicVariableServer.md): Send the variable value to the server - same limitations regarding variable type as publicVariable.
- [remoteExec](../../commands/remoteExec.md): Asks the server to execute the given function or script command on the given target machine(s). - Functions are executed in the scheduled environment; suspension is allowed.
- [remoteExecCall](../../commands/remoteExecCall.md): Unscheduled version of remoteExec. The only difference between remoteExec and remoteExecCall is that remoteExecCall will run functions in unscheduled environment.
- [remoteExecutedJIPID](../../commands/remoteExecutedJIPID.md): Returns JIP ID of the persistent call generated from JIP queue for the joining player (see remoteExec).
- [remoteExecutedOwner](../../commands/remoteExecutedOwner.md): Returns the machine network ID of the client that initiated Remote Execution.
- [removeAllMPEventHandlers](../../commands/removeAllMPEventHandlers.md): Removes all MP event handlers of the given type which were added by addMPEventHandler. Command needs to be executed only on one PC for MP event handler to be removed globally.
- [removeMPEventHandler](../../commands/removeMPEventHandler.md): Removes MP event handler added by addMPEventHandler.
- [removeSwitchableUnit](../../commands/removeSwitchableUnit.md): Remove a unit from the list of units available for Team Switch.
- [respawnVehicle](../../commands/respawnVehicle.md): Sets vehicle as respawnable in MP game (see Vehicle Respawn). The vehicle will be spawned at the locality and coordinates it was prior to destruction.
- [roleDescription](../../commands/roleDescription.md): Returns unit description set in the editor and visible on role selection screen in multiplayer.
- [score](../../commands/score.md): Returns the person's score in MP.
- [scoreSide](../../commands/scoreSide.md): Returns score for the given side. MP Only.
- [selectPlayer](../../commands/selectPlayer.md): Move player into given unit. Some usage advices: - Avoid using selectPlayer on editor-placed units in multiplayer, as it may, on occasion, lead to some undefined behaviour.
- [sendAUMessage](../../commands/sendAUMessage.md): Send the command to the list of clients.
- [sendUDPMessage](../../commands/sendUDPMessage.md): Send message to given address using UDP protocol. Returns false if the message has not been delivered
- [serverCommand](../../commands/serverCommand.md): Executes the given server command. Requires you to be logged-in admin as client to execute on a client, or provide the serverCommandPassword with the serverCommand execution as client/server to basically also get logged…
- [serverCommandAvailable](../../commands/serverCommandAvailable.md): Returns true if given serverCommand is available on current machine, false if not.
- [serverCommandExecutable](../../commands/serverCommandExecutable.md): Returns true if the serverCommand can be performed on the machine and in this exact environment, otherwise false.
- [serverName](../../commands/serverName.md): Returns name of the hosting server in MP, "" in SP.
- [serverNamespace](../../commands/serverNamespace.md): Returns server's namespace. This namespace is only available on the server for the server's uptime duration (same as uiNamespace).
- [serverTime](../../commands/serverTime.md): Returns the time since latest server (re)start in seconds.
- [setGroupOwner](../../commands/setGroupOwner.md): Changes the ownership of a group (and all its units) to a given client. The group leader must not be a player. This command only works when called from the server. Returns true if locality was changed.
- [setOwner](../../commands/setOwner.md): From server machine, change the ownership of an object to a given client. Using command in an unintended way will log a message to .rpt file.
- [setPlayable](../../commands/setPlayable.md) **[broken]**: Create a multiplayer role for the unit. The roles created this way are used for Join In Progress and Team Switch.
- [setPlayerRespawnTime](../../commands/setPlayerRespawnTime.md): Sets the time interval (in seconds) that the player must wait before respawn, for the next respawn only. It resets to mission default on mission start.
- [setVariable](../../commands/setVariable.md): Set variable to given value in the variable space of given element. Can be used to broadcast variables over the network.
- [switchableUnits](../../commands/switchableUnits.md): Returns a list of playable units available for switching to - Command is relative to the client on which it is executed and will only show playable units for the same side as player's group + player himself - In…
