From 870d9b76089d2d9acf983d713567a1470fe3c06f Mon Sep 17 00:00:00 2001 From: ThaPwned Date: Thu, 9 Feb 2017 21:02:16 +0100 Subject: [PATCH 1/2] Fixes weapon restriction More information: http://forums.sourcepython.com/viewtopic.php?f=20&p=9791#p9791 --- .../packages/source-python/weapons/restrictions.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/source-python/packages/source-python/weapons/restrictions.py b/addons/source-python/packages/source-python/weapons/restrictions.py index 44132fd3a..cff5df359 100644 --- a/addons/source-python/packages/source-python/weapons/restrictions.py +++ b/addons/source-python/packages/source-python/weapons/restrictions.py @@ -203,8 +203,11 @@ def __init__(self): def clear(self): """Remove all team and player restrictions.""" - self.team_restrictions.clear() + for x in self.team_restrictions.values(): + x.clear() + self.player_restrictions.clear() + self.team_restrictions.clear() def add_player_restrictions(self, player, *weapons): """Add the weapons to the player's restriction set. From 7dc6289d3fe4b46fc5230b48ce801eadcc6901c0 Mon Sep 17 00:00:00 2001 From: ThaPwned Date: Thu, 9 Feb 2017 22:05:27 +0100 Subject: [PATCH 2/2] Updated code --- .../packages/source-python/weapons/restrictions.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/source-python/packages/source-python/weapons/restrictions.py b/addons/source-python/packages/source-python/weapons/restrictions.py index cff5df359..f9d484be6 100644 --- a/addons/source-python/packages/source-python/weapons/restrictions.py +++ b/addons/source-python/packages/source-python/weapons/restrictions.py @@ -190,6 +190,10 @@ def __getitem__(self, item): raise KeyError( '"{0}" is neither a team number nor an alias.'.format(item)) + def clear(self): + for x in self.values(): + x.clear() + class WeaponRestrictionHandler(AutoUnload): """Class used to handle player and team restrictions.""" @@ -203,9 +207,6 @@ def __init__(self): def clear(self): """Remove all team and player restrictions.""" - for x in self.team_restrictions.values(): - x.clear() - self.player_restrictions.clear() self.team_restrictions.clear()