getAmmoInPedWeapon
GET_AMMO_IN_PED_WEAPON0x015A522136D7F951The 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.
getAmmoInPedWeapon(ped: Ped, weaponhash: Hash): numbergetAmmoInPedWeapon(ped: Ped, weaponhash: Hash): integerUsage
JavaScript
const result = getAmmoInPedWeapon(ped, weaponhash);Lua
local result = getAmmoInPedWeapon(ped, weaponhash)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
ped | Ped | number | integer |
weaponhash | Hash | number | integer |
Returns
int JavaScript number, Lua integerNotes
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