Skip to content

player_weapons_update2: weapon.clip returns 255 for weapon_knife on CS:GO #137

@KirillMysnik

Description

@KirillMysnik

The problem is that CS:GO uses get_property_uchar/set_property_uchar for getting/setting ammo and clips.

So the following code in player_weapons_update2 does not work:

    def get_clip(self):
        """Return the amount of ammo in the weapon's clip."""
        return self.clip if self.clip != -1 else 0

    def set_clip(self, value):
        """Set the amount of ammo in the weapon's clip."""
        # Does the weapon have ammo?
        if self.clip != -1:

            # Set the clip amount
            self.clip = value

As self.clip always returns 255.

Edit: possible solution might be using

return self.clip if self.clip % 256 != 255 else 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions