---
name: "selectWeapon"
type: command
status: ok
groups: ["Weapons"]
arma3_since: "0.50"
locality: {"argument": "local", "effect": "global", "server_exec": false}
source: https://community.bistudio.com/wiki/selectWeapon
revid: 373007
updated: 2025-03-11T23:11:21Z
---

# selectWeapon

*Command · Weapons · Arma 3 v0.50 · introduced in Operation Flashpoint v1.27*

Locality: arguments **local** · effect **global**

## Description

Selects the given weapon.

> [!NOTE]
> Passing empty string will not deselect current weapon. Use 'SwitchWeapon' [action](../commands/action.md) instead:
>
> ```sqf
> player action ["SwitchWeapon", player, player, -1]
> ```

## Syntax

### Syntax 1

```sqf
unitName selectWeapon muzzleName
```

**Parameters:**

- `unitName`: [Object](../topics/Object.md)
- `muzzleName`: [String](../topics/String.md) - name of the weapon or muzzle

  > [!IMPORTANT]
  > For weapons that have **more than one muzzle**, you have to input the **muzzleName** and not the **weaponName**.
  > - In Operation Flashpoint, in most cases, both names are the same. But check.
  > - In Armed Assault the weaponNames and muzzleNames are different.
  > - For muzzle names see CfgWeapons.

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

### Syntax 2

*since arma3 2.08*

```sqf
unit selectWeapon [weapon, muzzle, firemode]
```

**Parameters:**

- `unit`: [Object](../topics/Object.md) - person. This argument has to be [local](../commands/local.md), or it can be remote when executed on the [server](../commands/isServer.md)
- `weapon`: [String](../topics/String.md) - name of the weapon, personal or vehicle's weapon (see [weaponState](../commands/weaponState.md))
- `muzzle`: [String](../topics/String.md) - name of the selected muzzle (see [weaponState](../commands/weaponState.md))
- `firemode`: [String](../topics/String.md) - name of the firemode (see [weaponState](../commands/weaponState.md))

**Returns:** [Boolean](../topics/Boolean.md) or [Nothing](../topics/Nothing.md) - [true](../commands/true.md) on success, [false](../commands/false.md) on failure, [Nothing](../topics/Nothing.md) when the call to the command is dispatched over network

## Examples

### Example 1

```sqf
_soldier1 selectWeapon "LAWLauncher";
```

### Example 2

```sqf
player selectWeapon "M203Muzzle";
```

### Example 3

```sqf
player selectWeapon ["arifle_MX_GL_ACO_F", "arifle_MX_GL_ACO_F", "FullAuto"];
```

## See also

[fire](../commands/fire.md) · [forceWeaponFire](../commands/forceWeaponFire.md) · [primaryWeapon](../commands/primaryWeapon.md) · [handgunWeapon](../commands/handgunWeapon.md) · [secondaryWeapon](../commands/secondaryWeapon.md) · [weapons](../commands/weapons.md) · ArmA: Actions · [isSwitchingWeapon](../commands/isSwitchingWeapon.md)

## Community notes

**Dr_Eyeball** — 2008-08-05

Rather than simply using [selectWeapon](../commands/selectWeapon.md) to select your default weapon after adding them to your player, it is recommended you use a script instead similar to the following, which caters for multiple muzzles:

SelectWeapon.sqf

```sqf
// Desc: select default weapon & handle multiple muzzles
if (count weapons player > 0) then
{
    private ['_type', '_muzzles'];

    _type = ((weapons player) select 0);
    // check for multiple muzzles (eg: GL)
    _muzzles = getArray (configFile >> "cfgWeapons" >> _type >> "muzzles");

    if (count _muzzles > 1) then
    {
        player selectWeapon (_muzzles select 0);
    }
    else
    {
        player selectWeapon _type;
    };
};
```

---

**MaestrO.fr** — 2010-03-22

Can be used with [primaryWeapon](../commands/primaryWeapon.md) to select the primary weapon.
An example with muzzle care (see Dr_EyeBall note) :

```sqf
if ((primaryWeapon player) != "") then
{
    private ['_type', '_muzzles'];

    _type = primaryWeapon player;
    // check for multiple muzzles (eg: GL)
    _muzzles = getArray (configFile >> "cfgWeapons" >> _type >> "muzzles");

    if (count _muzzles > 1) then
    {
        player selectWeapon (_muzzles select 0);
    }
    else
    {
        player selectWeapon _type;
    };
};
```

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