RedM Index logoRedM Index
NativesHashesClothesBlipsPropsItem Tool
Sign inGet started

Reference

  • Natives
  • Hashes
  • Clothes
  • Blips
  • Props

Namespace

  1. Reference
  2. Natives
  3. _GET_PED_WEAPON_AMMO_FROM_GUID

_GET_PED_WEAPON_AMMO_FROM_GUID

returns the full amount of ammo that the ped has for the weapon by guid

WEAPONBuild 1207

Signature

lua
GetPedWeaponAmmoFromGuid(PlayerPedId(), itemGuid)
-- returns int

Parameters

NameTypeDescription
Ped—
Any*—

Usage

Named call
GetPedWeaponAmmoFromGuid(PlayerPedId(), itemGuid)
InvokeNative
Citizen.InvokeNative(0x4823F13A21F51964, PlayerPedId(), itemGuid)
lua 1
local function inventoryGetGuidFromItemid(item, pGuid, slotId)
    local outGuid = DataView.ArrayBuffer(8 * 13)
    local result = Citizen.InvokeNative(0x886DFD3E185C8A89, 1, pGuid, item, slotId, outGuid:Buffer(), Citizen.ResultAsInteger());
    if result ~= 1 then return nil end
    return outGuid:Buffer();
end

RegisterCommand("getammo", function()
    local characterGuid = inventoryGetGuidFromItemid(`CHARACTER`, 0, `SLOTID_NONE`)
    if not characterGuid then return end

    local weaponGuid = inventoryGetGuidFromItemid(`CARRIED_WEAPONS`, characterGuid, `SLOTID_CARRIED_WEAPONS`)
    if not weaponGuid then return end

    local itemGuid = inventoryGetGuidFromItemid(`WEAPON_SNIPERRIFLE_CARCANO`, weaponGuid, `SLOTID_WEAPON_0`)
    if not itemGuid then return end

    local ammo = Citizen.InvokeNative(0x4823F13A21F51964, PlayerPedId(), itemGuid)
    print("ammo: " .. ammo)
end, false)

Details

Hash
Source
VORPCORE/RDR3natives

Source: VORPCORE/RDR3natives

On this page

  • Signature
  • Parameters
  • Usage
  • Details