RedM Natives

_INVENTORY_ADD_ITEM_WITH_GUID

Hash0xCB5D11F9508A928D
Runtime nameInventoryAddItemWithGuid
NamespaceINVENTORY
SideClient
NameCommunity guess
Docs
Since build1207

Signature

BOOL _INVENTORY_ADD_ITEM_WITH_GUID(int inventoryId, Any* guid1, Any* guid2, Hash item, Hash inventoryItemSlot, int p5, Hash addReason);

Parameters

NameTypeDescription
inventoryIdint—
guid1Any*—
guid2Any*—
itemHash—
inventoryItemSlotHash—
p5int—
addReasonHash—

Returns BOOL

Description

inventoryItemSlotHash: https://pastebin.com/P6fyr3vr

Usage

Lua
local retval, guid1, guid2 = InventoryAddItemWithGuid(inventoryId, item, inventoryItemSlot, p5, addReason)

-- always works, by hash
local retval, guid1, guid2 = Citizen.InvokeNative(0xCB5D11F9508A928D, inventoryId, Citizen.PointerValueInt(), Citizen.PointerValueInt(), item, inventoryItemSlot, p5, addReason, Citizen.ReturnResultAnyway())
JavaScript and C#
JavaScript
const [retval, guid1, guid2] = InventoryAddItemWithGuid(inventoryId, item, inventoryItemSlot, p5, addReason);

// by hash
const [retval, guid1, guid2] = Citizen.invokeNative('0xCB5D11F9508A928D', inventoryId, Citizen.pointerValueInt(), Citizen.pointerValueInt(), item, inventoryItemSlot, p5, addReason, Citizen.returnResultAnyway());
C#
var guid1 = new OutputArgument();
var guid2 = new OutputArgument();
bool retval = Function.Call<bool>((Hash)0xCB5D11F9508A928D, inventoryId, guid1, guid2, item, inventoryItemSlot, p5, addReason);
// guid1.GetResult<int>()
// guid2.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.
  • The name is a community guess and may change. If the named call is missing in your client build, use InvokeNative with the hash — it always works.

Sources

alloc8or RDR3 NativeDB

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