# getPedWeapon (Client)

> Gets the weapon a ped or player is holding, as this client knows it.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Peds
- **URL**: https://wiki.mymp.gg/en/getPedWeapon-client
- **Counterpart**: Also exists on the server, with its own implementation: [getPedWeapon (Server)](https://wiki.mymp.gg/en/getPedWeapon-server.md)

## Syntax

```lua
int|false getPedWeapon(ped ped)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `ped` | `ped` | The ped or player. |

## Returns

The weapon type in the current slot (`0` when the slot is empty), or `false` if the element is not a ped or a player.

The type is the weapon's `type` in the pack's weapon metadata, such as `22` for `PISTOL`. A ped that is streamed out returns the last weapon this client knew it to hold.

## Example

```lua
addCommandHandler("weapon", function()
    print(getPedWeapon(localPlayer))
end)
```

### Coming from MTA

Takes no slot: it always returns the weapon in the current slot.

## See also

- [getPedWeapon (Server)](https://wiki.mymp.gg/en/getPedWeapon-server.md): Gets the weapon a ped or player is holding.
- [giveWeapon (Server)](https://wiki.mymp.gg/en/giveWeapon.md): Gives a weapon with ammo to a ped or player.
- [onClientPlayerWeaponFire (Client)](https://wiki.mymp.gg/en/onClientPlayerWeaponFire.md): Fired on this client after a player fires a shot, whether the local player or another one this client sees.
