getMaxAmmoByType
GET_MAX_AMMO_BY_TYPE0x585847C5E4E11709The GTA V native GET_MAX_AMMO_BY_TYPE of the WEAPON namespace, as LS:MP client scripts call it: the global function getMaxAmmoByType, in JavaScript and in Lua.
getMaxAmmoByType(ped: Ped, ammoTypeHash: Hash): [ok: boolean, ammo: number]getMaxAmmoByType(ped: Ped, ammoTypeHash: Hash): boolean, integerUsage
JavaScript
const [ok, ammo] = getMaxAmmoByType(ped, ammoTypeHash);Lua
local ok, ammo = getMaxAmmoByType(ped, ammoTypeHash)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
ped | Ped | number | integer |
ammoTypeHash | Hash | number | integer |
Returns
2 values, in this order: an array in JavaScript, multiple return values in Lua.
| # | Value | Type | JavaScript | Lua | Description |
|---|---|---|---|---|---|
| 1 | ok | BOOL | boolean | boolean | The native’s own return value. |
| 2 | ammo | int | number | integer | output |
Notes
From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.
Returns the max ammo for an ammo type. Ammo types: https://gist.github.com/root-cause/faf41f59f7a6d818b7db0b839bd147c1
Reference
- Namespace
- Weapon WEAPON
- In the game
BOOL GET_MAX_AMMO_BY_TYPE(Ped ped, Hash ammoTypeHash, int* ammo)- Hash
0x585847C5E4E11709- Introduced
- Game build 1103 legacy numbering
- Formerly
_GET_MAX_AMMO_2_GET_MAX_AMMO_BY_TYPE