LabAPI icon indicating copy to clipboard operation
LabAPI copied to clipboard

[BUG]: PlayerEvents.Uncuffed does not fire on automatic undisarm (distance, weapon drop, death, etc.)

Open efrosim opened this issue 1 month ago • 0 comments

Before You Report

  • [x] I have searched for existing reports of this bug, and this bug report is unique.

Version

1.1.7

Description

PlayerEvents.Uncuffed is only called when a player manually undisarms someone by holding the [E] interaction key (DisarmingHandlers.ServerProcessDisarmMessage). It completely ignores automatic undisarm handled by DisarmedPlayers.cs (e.g. when distance > 90m, cuffer drops weapons, player dies/changes role, or SetDisarmedStatus(null) is called). This causes state desync in plugins tracking disarmed players.

To Reproduce

  1. Subscribe to PlayerEvents.Uncuffed.
  2. Cuff a player.
  3. Walk 90+ meters away until the game engine automatically frees the player (or drop all weapons from the cuffer's inventory).
  4. Notice that the player is free (IsDisarmed == false), but PlayerEvents.Uncuffed was never invoked.

Expected Behavior

PlayerEvents.Uncuffed should fire whenever a player is removed from DisarmedPlayers.Entries. In PlayerUncuffedEventArgs, Player should be nullable (ReferenceHub?) for cases where the uncuff was performed by game mechanics rather than an active player.

Additional Information

In DisarmedPlayers.cs, automatic undisarm happens via Entries.RemoveAt(i) inside Update(), OnRoleChanged, and Inventory.OnItemsModified, none of which invoke PlayerEvents.OnUncuffed.

efrosim avatar Nov 05 '26 04:11 efrosim