isPlayer

From Bohemia Interactive Community
Jump to navigation Jump to search
Hover & click on the images for description

Description

Description:
Checks if given person is a player. Returns true for headless clients as well.
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.
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.
Groups:
Multiplayer

Syntax

Syntax:
isPlayer unit
Parameters:
unit: Object
Return Value:
Boolean

Alternative Syntax

Syntax:
isPlayer [person]
Parameters:
person: Object - dead or alive unit
Return Value:
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

Additional Information

See also:
player playableSlotsNumber playableUnits playersNumber

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
Kronzky - c
Posted on Aug 01, 2006 - 00:00 (UTC)
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.