getPedAmmoTypeFromWeapon
GET_PED_AMMO_TYPE_FROM_WEAPON0x7FEAD38B326B9F74The GTA V native GET_PED_AMMO_TYPE_FROM_WEAPON of the WEAPON namespace, as LS:MP client scripts call it: the global function getPedAmmoTypeFromWeapon, in JavaScript and in Lua.
getPedAmmoTypeFromWeapon(ped: Ped, weaponHash: Hash): HashgetPedAmmoTypeFromWeapon(ped: Ped, weaponHash: Hash): HashUsage
const hash = getPedAmmoTypeFromWeapon(ped, weaponHash);local hash = getPedAmmoTypeFromWeapon(ped, weaponHash)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
ped | Ped | number | integer |
weaponHash | Hash | number | integer |
Returns
Hash JavaScript number, Lua integerA game hash. Natives return it unsigned (0 to 4294967295), the value lsmp.hash gives. As an argument, the signed and unsigned forms of a hash are the same value.
Notes
From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.
Returns the current ammo type of the specified ped's specified weapon.
MkII magazines will change the return value, like Pistol MkII returning AMMO_PISTOL without any components and returning AMMO_PISTOL_TRACER after Tracer Rounds component is attached.
Use getPedOriginalAmmoTypeFromWeapon if you always want AMMO_PISTOL.
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
Hash GET_PED_AMMO_TYPE_FROM_WEAPON(Ped ped, Hash weaponHash)- Hash
0x7FEAD38B326B9F74- Formerly
_GET_PED_AMMO_TYPE