weapons.entity module
Provides simplified weapon functionality.
-
class weapons.entity.Weapon(index, caching=None)[source]
Bases: WeaponMixin
, Entity
Allows easy usage of the weapon’s attributes.
-
__init__(index, caching=True)[source]
Initialize the object.
- Parameters:
-
- Raises:
ValueError – Raised if the index is invalid.
-
get_ammo()[source]
Return the amount of ammo the player has for the weapon.
-
get_clip()[source]
Return the amount of ammo in the weapon’s clip.
-
get_secondary_fire_ammo()[source]
Return the secondary fire ammo the player has for the weapon.
-
get_secondary_fire_clip()[source]
Return the amount of ammo in the weapon’s secondary fire clip.
-
remove()[source]
Remove the weapon.
-
set_ammo(value)[source]
Set the player’s ammo property for the weapon.
-
set_clip(value)[source]
Set the amount of ammo in the weapon’s clip.
-
set_secondary_fire_ammo(value)[source]
Set the player’s secondary fire ammo property for the weapon.
-
set_secondary_fire_clip(value)[source]
Set the amount of ammo in the weapon’s secondary fire clip.
-
property ammo
Property to get/set the weapon’s ammo.
-
property clip
Property to get/set the weapon’s clip.
-
property secondary_fire_ammo
Property to get/set the weapon’s secondary fire ammo.
-
property secondary_fire_clip
Property to get/set the weapon’s secondary fire clip.
-
property weapon_name
Return the full class name of the weapon.
-
class _weapons._entity.WeaponMixin
Bases: BaseEntity
-
__init__((object)arg1, (int)entity_index) → object
-
is_networked((WeaponMixin)arg1) → bool :
Return True if the entity is networked.
- Return type:
bool
-
is_player((WeaponMixin)arg1) → bool :
Return True if the entity is a player.
- Return type:
bool
-
is_weapon((WeaponMixin)arg1) → bool :
Return True if the entity is a weapon.
- Return type:
bool
-
property ammoprop
Get/set the weapons’s primary fire ammo prop type.
- Return type:
int
-
property flip_view_model
Get/set the weapons’s flip view model.
- Return type:
int
-
property next_attack
Get/set the weapons’s next primary fire attack time.
- Return type:
float
-
property next_secondary_fire_attack
Get/set the weapons’s next secondary fire attack time.
- Return type:
float
-
property owner_handle
Get/set the weapons’s owner handle.
- Return type:
int
-
property primary_ammo_count
Get/set the weapons’s primary ammo count.
Note
Only available in CS:GO.
- Return type:
int
-
property secondary_ammo_count
Get/set the weapons’s secondary ammo count.
Note
Only available in CS:GO.
- Return type:
int
-
property secondary_fire_ammoprop
Get/set the weapons’s secondary fire ammo prop type.
- Return type:
int
-
property world_model_index
Get/set the weapons’s world model index.
- Return type:
int