WeaponClient

getAmmoInPedWeapon

GET_AMMO_IN_PED_WEAPON0x015A522136D7F951

The GTA V native GET_AMMO_IN_PED_WEAPON of the WEAPON namespace, as LS:MP client scripts call it: the global function getAmmoInPedWeapon, in JavaScript and in Lua.

SignatureJavaScript
getAmmoInPedWeapon(ped: Ped, weaponhash: Hash): number
SignatureLua
getAmmoInPedWeapon(ped: Ped, weaponhash: Hash): integer

Usage

JavaScript
const result = getAmmoInPedWeapon(ped, weaponhash);
Lua
local result = getAmmoInPedWeapon(ped, weaponhash)

Parameters

ParameterTypeJavaScriptLua
pedPednumberinteger
weaponhashHashnumberinteger

Returns

int JavaScript number, Lua integer

Notes

From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.

getAmmoInPedWeapon(playerPedId(), a_0)

From decompiled scripts
Returns total ammo in weapon

GTALua Example :
natives.WEAPON.GET_AMMO_IN_PED_WEAPON(plyPed, WeaponHash)
Full list of weapons by DurtyFree: https://github.com/DurtyFree/gta-v-data-dumps/blob/master/weapons.json

Reference

Namespace
Weapon WEAPON
In the game
int GET_AMMO_IN_PED_WEAPON(Ped ped, Hash weaponhash)
Hash
0x015A522136D7F951

Open in the interactive natives reference