I have an error which spamming on my server. I need your help to fix it.
I think the problem is that event player_spawn has been called before player is really spawn but i don't know if it's the real problem.
Syntax: Select all
_knifeonly = set(weapon.basename for weapon in WeaponClassIter()) - { 'weapon_knife', 'weapon_c4' }
Syntax: Select all
.
@events('player_spawn')
def _on_player_spawn(self, player, **eargs):
player.restrict_weapons(*_knifeonly)
for weapon in player.weapons(not_filters=['knife', 'c4']):
player.drop_weapon(weapon.pointer, None, None)
@events('player_death')
def _on_player_death(self, player, **eargs):
player.unrestrict_weapons(*_knifeonly)
Syntax: Select all
[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/packages/source-python/weapons/restrictions.py", line 384, in _on_weapon_bump
make_object(Player, args[0]), edict_from_pointer(args[1]).classname)
File "../addons/source-python/packages/source-python/weapons/restrictions.py", line 67, in on_player_bumping_weapon
value = handler.on_player_bumping_weapon(player, weapon_name)
File "../addons/source-python/packages/source-python/weapons/restrictions.py", line 286, in on_player_bumping_weapon
return not self.is_player_restricted(player, weapon)
File "../addons/source-python/packages/source-python/weapons/restrictions.py", line 312, in is_player_restricted
return self.is_team_restricted(player.team, weapon_name)
File "../addons/source-python/packages/source-python/weapons/restrictions.py", line 322, in is_team_restricted
return weapon_manager[weapon].basename in self.team_restrictions[team]
File "../addons/source-python/packages/source-python/weapons/restrictions.py", line 191, in __getitem__
'"{0}" is neither a team number nor an alias.'.format(item))
KeyError: '"2" is neither a team number nor an alias.'
Sincerly Existenz.