---
name: "countEnemy"
type: command
status: ok
groups: ["Sides", "Object Detection"]
arma3_since: "0.50"
locality: {"argument": "global", "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/countEnemy
revid: 377183
updated: 2026-01-01T10:50:22Z
---

# countEnemy

*Command · Sides, Object Detection · Arma 3 v0.50 · introduced in Operation Flashpoint v1.00*

Locality: arguments **global**

## Description

Count how many units in the array are considered enemy to the given unit.

## Syntax

```sqf
unit countEnemy others
```

**Parameters:**

- `unit`: [Object](../topics/Object.md)
- `others`: [Array](../topics/Array.md) of [Object](../topics/Object.md)s

**Returns:** [Number](../topics/Number.md)

## Examples

### Example 1

```sqf
_num = player countEnemy list _triggerOne;
```

## See also

[countFriendly](../commands/countFriendly.md) · [count](../commands/count.md) · [countUnknown](../commands/countUnknown.md) · [countSide](../commands/countSide.md) · [countType](../commands/countType.md)

<sub>Source: [BI Community Wiki — countEnemy](https://community.bistudio.com/wiki/countEnemy) (revision 377183).</sub>
