[CSGO] can't grep weapon ammo
Posted: Fri Aug 05, 2016 12:05 am
Dear community,
I can't grep the weapons ammo. I can get the weapon clip, but I need to get all available ammo. The following errror occurs:
Source:
After that I figured out that you have some kind of Weapons class at all :) so I tried to use that directly. Same error:
Changing the __init__.py in the "weapons" folder of sourcepython is not solving the problem at all. At least I get another error. Is CSGO the problem or did I found some bug in sourcepython? I'm using one of the latest precompiled binaries directly from your "Builds" section (Current Source.Python version: 410).
I can't grep the weapons ammo. I can get the weapon clip, but I need to get all available ammo. The following errror occurs:
Syntax: Select all
[SP] Caught an Exception:
Traceback (most recent call last):
File '../addons/source-python/plugins/conquest/conquest.py', line 58, in tick_listener
class_weapons.ontick()
File '../addons/source-python/plugins/conquest/weapons.py', line 235, in ontick
print(weapon.get_ammo())
File '../addons/source-python/packages/source-python/weapons/entity.py', line 68, in get_ammo
weapon_manager.ammoprop + '%03d' % self.ammoprop)
File '../addons/source-python/packages/source-python/entities/entity.py', line 293, in get_property_int
return self._get_property(name, 'int')
File '../addons/source-python/packages/source-python/entities/entity.py', line 347, in _get_property
name, server_class.properties[name].prop_type, prop_type))
TypeError: Property 'm_iAmmo.007' is of type ushort not int
Source:
Syntax: Select all
print(player.get_primary_ammo())
After that I figured out that you have some kind of Weapons class at all :) so I tried to use that directly. Same error:
Syntax: Select all
if player.get_primary():
weapon = Weapon(player.get_primary())
if weapon:
print(weapon.get_ammo())
Changing the __init__.py in the "weapons" folder of sourcepython is not solving the problem at all. At least I get another error. Is CSGO the problem or did I found some bug in sourcepython? I'm using one of the latest precompiled binaries directly from your "Builds" section (Current Source.Python version: 410).