RedM Natives

INVENTORY_GET_GUID_FROM_ITEMID

Hash0x886DFD3E185C8A89
Runtime nameInventoryGetGuidFromItemid
NamespaceINVENTORY
SideClient
NameOfficial
Docs
Since build1207

Signature

BOOL INVENTORY_GET_GUID_FROM_ITEMID(int inventoryId, Any* guid, Hash p2, Hash slotId, Any* outGuid);

Parameters

NameTypeDescription
inventoryIdint—
guidAny*—
p2Hash—
slotIdHash—
outGuidAny*—

Returns BOOL

Usage

Lua
local retval, guid, outGuid = InventoryGetGuidFromItemid(inventoryId, p2, slotId)

-- always works, by hash
local retval, guid, outGuid = Citizen.InvokeNative(0x886DFD3E185C8A89, inventoryId, Citizen.PointerValueInt(), p2, slotId, Citizen.PointerValueInt(), Citizen.ReturnResultAnyway())
JavaScript and C#
JavaScript
const [retval, guid, outGuid] = InventoryGetGuidFromItemid(inventoryId, p2, slotId);

// by hash
const [retval, guid, outGuid] = Citizen.invokeNative('0x886DFD3E185C8A89', inventoryId, Citizen.pointerValueInt(), p2, slotId, Citizen.pointerValueInt(), Citizen.returnResultAnyway());
C#
var guid = new OutputArgument();
var outGuid = new OutputArgument();
bool retval = Function.Call<bool>((Hash)0x886DFD3E185C8A89, inventoryId, guid, p2, slotId, outGuid);
// guid.GetResult<int>()
// outGuid.GetResult<int>()
  • Hash parameters: the named function also accepts a string and hashes it for you; Citizen.InvokeNative needs the number — pass joaat("name") or a backtick literal like `name`.
  • Pointer (out) arguments are not passed in Lua/JS: their values are returned after the result, in order.
  • Any* arguments are often structs. Build them with a DataView buffer and pass it with :Buffer() — see the examples and notes below.

Sources

alloc8or RDR3 NativeDB

Something wrong or missing? Contribute a verified note — corrections ship through pull requests.