WeaponClient1 output

getMaxAmmo

GET_MAX_AMMO0xDC16122C7A20C933

The 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.

SignatureJavaScript
getMaxAmmo(ped: Ped, weaponHash: Hash): [ok: boolean, ammo: number]
SignatureLua
getMaxAmmo(ped: Ped, weaponHash: Hash): boolean, integer

Usage

JavaScript
const [ok, ammo] = getMaxAmmo(ped, weaponHash);
Lua
local ok, ammo = getMaxAmmo(ped, weaponHash)

Parameters

ParameterTypeJavaScriptLua
pedPednumberinteger
weaponHashHashnumberinteger

Returns

2 values, in this order: an array in JavaScript, multiple return values in Lua.

#ValueTypeJavaScriptLuaDescription
1okBOOLbooleanbooleanThe native’s own return value.
2ammointnumberintegeroutput

Notes

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

Reference

Namespace
Weapon WEAPON
In the game
BOOL GET_MAX_AMMO(Ped ped, Hash weaponHash, int* ammo)
Hash
0xDC16122C7A20C933

Open in the interactive natives reference