Jump to content

RemoveBehavior on death runs too early (race condition)

Pending 1.2.11

dFxPhoeniX
dFxPhoeniX

Posted

Hi,
I’m seeing a race condition in SimpleStatus when a player dies. In OnPlayerDeath, the plugin calls:

BehaviorManager.RemoveBehavior(basePlayer.UserIDString);

This removes the StatusBehaviour/UI immediately, so another plugin (mine) that clears the player’s status in OnPlayerDeath (via SetStatus(..., 0)) often doesn’t get a chance to run/update before the behavior is removed. Result: the status UI can remain stuck/not cleared on death.

Fix: wrap the removal in NextTick:

NextTick(() => { BehaviorManager.RemoveBehavior(basePlayer.UserIDString); });

This lets other plugins finish their OnPlayerDeath logic first and prevents the UI/status from getting stuck.
Thanks!

2.2m

Downloads

Total number of downloads.

10.4k

Customers

Total customers served.

150.2k

Files Sold

Total number of files sold.

3.2m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.