2025-05-23 11:50:05 -04:00
### Function: SetAccessToEntityCommand(Spawn, Player, CommandString, Allowed)
2025-05-19 13:13:42 -04:00
2025-05-23 11:50:05 -04:00
**Description:**
Controls whether a particular primary entity command (right-click option) is enabled for a given spawn. You can use this to enable or disable specific interactions dynamically.
2025-05-19 13:13:42 -04:00
2025-05-23 11:50:05 -04:00
**Parameters:**
- `Spawn` : Spawn – The entity whose command access to modify.
- `Player` : Spawn – The Player who will receive access to the command.
- `CommandString` : String – The name of the command (same as used in AddPrimaryEntityCommand).
- `Allowed` : UInt8 – `1` to allow players to use this command on the spawn; `0` to remove it.
2025-05-19 13:13:42 -04:00
2025-05-23 11:50:05 -04:00
**Returns:** Return's true if successfully adding access to the entity command.
2025-05-19 13:13:42 -04:00
2025-05-23 11:50:05 -04:00
**Example:**
2025-05-19 13:13:42 -04:00
2025-05-23 11:50:05 -04:00
```lua
2025-05-19 13:13:42 -04:00
-- Example usage (disable the 'Buy' option on a merchant after shop closes)
2025-05-23 11:50:05 -04:00
SetAccessToEntityCommand(MerchantNPC, "Buy", 0)
```