getMaxAmmo
GET_MAX_AMMO0xDC16122C7A20C933The GTA V native GET_MAX_AMMO of the WEAPON namespace, as LS:MP client scripts call it: the global function getMaxAmmo, in JavaScript and in Lua.
getMaxAmmo(ped: Ped, weaponHash: Hash): [ok: boolean, ammo: number]getMaxAmmo(ped: Ped, weaponHash: Hash): boolean, integerUsage
JavaScript
const [ok, ammo] = getMaxAmmo(ped, weaponHash);Lua
local ok, ammo = getMaxAmmo(ped, weaponHash)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
ped | Ped | number | integer |
weaponHash | 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.
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
BOOL GET_MAX_AMMO(Ped ped, Hash weaponHash, int* ammo)- Hash
0xDC16122C7A20C933