diff --git a/addons/source-python/plugins/udm/players/__init__.py b/addons/source-python/plugins/udm/players/__init__.py index 8b035da..d61dcdc 100644 --- a/addons/source-python/plugins/udm/players/__init__.py +++ b/addons/source-python/plugins/udm/players/__init__.py @@ -109,11 +109,11 @@ def disable_damage_protection(cls, index): # Reset the color player.color = WHITE - @classmethod - def reset_team_changes(cls, index): + @staticmethod + def reset_team_changes(userid): """Reset the team change count for the player.""" - with contextlib.suppress(ValueError): - player_team_changes[PlayerEntity(index)] = 0 + if userid in player_team_changes: + del player_team_changes[userid] def tell(self, prefix, message): """Tell the player a prefixed chat message.""" diff --git a/addons/source-python/plugins/udm/udm.py b/addons/source-python/plugins/udm/udm.py index cffd138..8bbb899 100755 --- a/addons/source-python/plugins/udm/udm.py +++ b/addons/source-python/plugins/udm/udm.py @@ -460,7 +460,7 @@ def client_command_filter(command, index): delay_manager( f'reset_team_changes_{player.userid}', delay_time * 60.0, - PlayerEntity.reset_team_changes, (player.index, ) + PlayerEntity.reset_team_changes, (player.userid, ) ) # Tell the player