Arma 3 Scripting

Command in Multiplayer

isPlayer

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

Description

Checks if given person is a player. Returns true for headless clients as well.

Note

Prior to Arma 3 v2.02, in some cases the identity of certain player units could fail to propagate to other clients and the server, which caused isPlayer and getPlayerUID to incorrectly return false and "" respectively, where the affected units were not local. See this GitHub bug report for more info. Remain vigilant toward potential false negatives.

Important

When used on vehicles, this command will return true if effectiveCommander of the vehicle is player. Just because it returns true does not automatically mean we have a player unit. Unlike main syntax, alternative syntax always returns false when used on vehicles, even if they're controlled by a player.

Syntax

Syntax 1

isPlayer unit

Parameters:

Returns: Boolean

Syntax 2

since arma3 2.06

isPlayer [person]

Parameters:

Returns: Boolean - true if is/was player and the identity still exists on the (dead) body

Examples

Example 1

if (isPlayer _Soldier1) then
{
    _soldier1 setDamage 1;
};

Example 2

_playerCount = { isPlayer _x } count playableUnits;

Example 3

private _wasPlayer = isPlayer [_deadBody]; // returns true if _deadBody's identity still exists and was controlled by a player

See also

player · playableSlotsNumber · playableUnits · playersNumber

Community notes

Kronzky

This is not the same as testing object == player, because in MP it tests for any player, not only for the local one. If object is a vehicle, the test is done for the vehicle commander.