Skip to content

INVENTORY::_0xFD41D1D4350F6413 fails when another player is nearby due to blocking flags #3891

Description

@OualiS

What happened?

When calling INVENTORY::_0xFD41D1D4350F6413, the native works correctly when the player is alone, but fails silently when another player is nearby.

After analyzing the decompiled shop_general.c script (func_775), the issue is that the flags field (f_6 of the struct passed to the native) gets blocking bits (4 and 8) set when:

  1. func_773() returns true (detects another player nearby via tunable checks)
  2. Global_1956123.f_1 is 0 (catalog not marked as "open")

This results in f_6 = 12 (bits 4 | 8), which causes the native to reject the inventory operation. The only bypass is if the item is in the shop's 20-item whitelist (Global_1915715.f_3[shopId].f_418[]), which resets f_6 to 0.

Expected result

The native INVENTORY::_0xFD41D1D4350F6413 should process the inventory operation regardless of whether another player is nearby, or at minimum provide an error/return value indicating why it was blocked.

Reproduction steps

  1. Join an online session and go to a shop
  2. Call INVENTORY::_0xFD41D1D4350F6413 with a valid item struct — it works
  3. Have another player stand near you (same shop area)
  4. Call the same native with the same parameters — it silently fails

Importancy

There's a workaround

Area(s)

RedM

Specific version(s)

Build 1491.50

Additional information

Root cause traced in decompiled script script_mp_rel/shop_general.c, function func_775 (lines 25242-25362).

The blocking logic chain:

  • func_773() detects multiplayer context via tunable hashes
  • Combined with !Global_1956123.f_1 (catalog not open), sets bVar35 = true
  • This forces bVar37 = true → iVar32 |= 4 | 8 (blocking flags)
  • Unless the item is in the shop whitelist (Global_1915715.f_3[shopId].f_418[0..19]), the flags remain and the native rejects the operation

Possible workarounds:

  • Set Global_1956123.f_1 = 1 before calling the native
  • Force f_6 = 0 in the struct before passing it to the native
  • Add the item to the shop whitelist array

Metadata

Metadata

Assignees

No one assigned

    Labels

    RedMIssues/PRs related to RedMbug

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions