コード例 #1
0
ファイル: __init__.py プロジェクト: dsezen/Source.Python
    def _set_weapon_clip(self,
                         value,
                         classname=None,
                         is_filters=None,
                         not_filters=None):
        """Set the player's clip value for the given arguments.

        Sets for the first weapon found from the given arguments.
        """
        # Get the index for the given arguments
        index = self.get_weapon_index(classname, is_filters, not_filters)

        # Was no index found?
        if index is None:

            # Raise an error
            raise LookupError('No index found for given arguments '
                              '"{0}, {1}, {2}" for player "{3}"'.format(
                                  classname, is_filters, not_filters,
                                  self.userid))

        # Get the entity's Entity instance
        weapon = Entity(index)

        # Set the weapon's clip value
        weapon.clip = value