# PED::_GET_SHOP_ITEM_COMPONENT_AT_INDEX

- **Hash:** `0x77BA37622E22023B`
- **Namespace:** PED
- **Runtime name (Lua/JS):** `GetShopItemComponentAtIndex`
- **Side:** client (game native)
- **Name status:** community guess (may change)
- **Documentation:** described with examples
- **Since game build:** 1207
- **URL:** https://natives.borderlinerp.com/natives/PED/_GET_SHOP_ITEM_COMPONENT_AT_INDEX

## Signature

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

## Parameters

- `ped` (`Ped`)
- `index` (`int`)
- `resolveSelection` (`BOOL`)
- `outStatusFlag` (`BOOL*`)
- `outWearableState` (`Hash*`)

## Returns

`Hash`

## Description

*Source: 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

*Source: VORPCORE RDR3natives*

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

## Usage

### Lua

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

-- always available, by hash
local retval, outStatusFlag, outWearableState = Citizen.InvokeNative(0x77BA37622E22023B, ped, index, resolveSelection, Citizen.PointerValueInt() --[[ BOOL* ]], Citizen.PointerValueInt(), Citizen.ResultAsInteger())
```

### JavaScript

```js
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#

```csharp
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

*Source: VORPCORE RDR3natives*

```lua
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.*
