WeaponClient

getWeaponClipSize

GET_WEAPON_CLIP_SIZE0x583BE370B1EC6EB4

The GTA V native GET_WEAPON_CLIP_SIZE of the WEAPON namespace, as LS:MP client scripts call it: the global function getWeaponClipSize, in JavaScript and in Lua.

SignatureJavaScript
getWeaponClipSize(weaponHash: Hash): number
SignatureLua
getWeaponClipSize(weaponHash: Hash): integer

Usage

JavaScript
const result = getWeaponClipSize(weaponHash);
Lua
local result = getWeaponClipSize(weaponHash)

Parameters

ParameterTypeJavaScriptLua
weaponHashHashnumberinteger

Returns

int JavaScript number, Lua integer

Notes

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

// Returns the size of the default weapon component clip.

Use it like this:

char cClipSize[32];
Hash cur;
if (getCurrentPedWeapon(playerPed, &cur, 1))
{
    if (isWeaponValid(cur))
    {
        int iClipSize = getWeaponClipSize(cur);
        sprintf_s(cClipSize, "ClipSize: %.d", iClipSize);
        vDrawString(cClipSize, 0.5f, 0.5f);
    }
}

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_WEAPON_CLIP_SIZE(Hash weaponHash)
Hash
0x583BE370B1EC6EB4

Open in the interactive natives reference