RedM Natives

_GET_SHOP_ITEM_COMPONENT_AT_INDEX

Returns 0 if index invalid/unresolvable; else the shop component hash.

Hash0x77BA37622E22023B
Runtime nameGetShopItemComponentAtIndex
NamespacePED
SideClient
NameCommunity guess
Docs
Since build1207

Signature

Hash _GET_SHOP_ITEM_COMPONENT_AT_INDEX(Ped ped, int index, BOOL resolveSelection, BOOL* outStatusFlag, Hash* outWearableState);

Parameters

NameTypeDescription
pedPed—
indexint—
resolveSelectionBOOL—
outStatusFlagBOOL*—
outWearableStateHash*—

Returns Hash

Description

alloc8or RDR3 NativeDB

Returns 0 if index invalid/unresolvable; else the shop component hash.
resolveSelection: true -> run the resolver (rebuild from ped meta/outfit - MP “net shop” style); false -> use cached entry only (singleplayer - offline).
outStatusFlag: Set to 1 if the entry's internal status byte != 0.
outWearableState: See _UPDATE_SHOP_ITEM_WEARABLE_STATE

VORPCORE RDR3natives

Returns the current shop item component at index and it's wearable state

Usage

Lua
local retval, outStatusFlag, outWearableState = GetShopItemComponentAtIndex(ped, index, resolveSelection)

-- always works, by hash
local retval, outStatusFlag, outWearableState = Citizen.InvokeNative(0x77BA37622E22023B, ped, index, resolveSelection, Citizen.PointerValueInt() --[[ BOOL* ]], Citizen.PointerValueInt(), Citizen.ResultAsInteger())
JavaScript and C#
JavaScript
const [retval, outStatusFlag, outWearableState] = GetShopItemComponentAtIndex(ped, index, resolveSelection);

// by hash
const [retval, outStatusFlag, outWearableState] = Citizen.invokeNative('0x77BA37622E22023B', ped, index, resolveSelection, Citizen.pointerValueInt() /* BOOL* */, Citizen.pointerValueInt(), Citizen.returnResultAnyway(), Citizen.resultAsInteger());
C#
var outStatusFlag = new OutputArgument();
var outWearableState = new OutputArgument();
int retval = Function.Call<int>((Hash)0x77BA37622E22023B, ped, index, resolveSelection, outStatusFlag, outWearableState);
// outStatusFlag.GetResult<bool>()
// outWearableState.GetResult<int>()
  • Pointer (out) arguments are not passed in Lua/JS: their values are returned after the result, in order.
  • 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.

Examples

LUA · VORPCORE RDR3natives
local ped = PlayerPedId()
local numComponent = GetNumComponentsInPed(ped)
for index = 0, numComponent -1 do
	local componentHash,_,wearableState = GetShopItemComponentAtIndex(ped, index, true, Citizen.ResultAsInteger(), Citizen.ResultAsInteger())
	print('Index:',index,'Hash:',componentHash,'wearable state:', wearableState)
end

Sources

alloc8or RDR3 NativeDB · VORPCORE RDR3natives

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