# Weapon

Utility function for reading the player's current weapon state.

***

## getCurrentWeaponInfo

Returns information about the weapon the ped currently has equipped.

```lua
local info = KOJA.Client.getCurrentWeaponInfo(ped)
```

| Parameter | Type     | Description       |
| --------- | -------- | ----------------- |
| `ped`     | `number` | Ped entity handle |

**Returns** `table | nil`

| Field        | Type     | Description                               |
| ------------ | -------- | ----------------------------------------- |
| `weaponHash` | `number` | Hash of the current weapon                |
| `ammoInClip` | `number` | Bullets remaining in the current magazine |
| `totalAmmo`  | `number` | Total ammo carried for this weapon        |

Returns `nil` if the ped has no weapon equipped.

***

## Example

```lua
local ped = PlayerPedId()
local info = KOJA.Client.getCurrentWeaponInfo(ped)

if info then
    print('Weapon hash:', info.weaponHash)
    print('Clip ammo:', info.ammoInClip)
    print('Total ammo:', info.totalAmmo)
else
    print('No weapon equipped')
end
```

**With weapon name lookup:**

```lua
local info = KOJA.Client.getCurrentWeaponInfo(PlayerPedId())
if info then
    local name = GetDisplayNameFromVehicleModel(info.weaponHash)  -- works for weapons too
    print('Equipped:', name)
end
```

## Related pages

- [Getting Started](/koja-lib/getting-started) — Configuration and Installation for Getting Started.
- [API Reference](/koja-lib/api-reference) — Client API and Server API for API Reference.
- [Frameworks](/koja-lib/frameworks) — Custom Framework and Overview for Frameworks.
- [Inventory](/koja-lib/inventory) — Custom Inventory and Overview for Inventory.
- [Text UI](/koja-lib/text-ui) — A small on-screen prompt that shows an action key and a label.
- [Vehicle](/koja-lib/vehicle) — Utility functions for reading vehicle state on the client.
