Skip to content

TakeDamageInfoBaseWrapper::get_weapon raises exception #127

Description

@KirillMysnik

CS:S, Windows

The following code

from entities import TakeDamageInfo
from entities.hooks import EntityCondition
from entities.hooks import EntityPreHook
from memory import make_object


@EntityPreHook(EntityCondition.is_player, 'on_take_damage')
def on_take_damage(args):
    info = make_object(TakeDamageInfo, args[1])
    info.weapon

produces the following exception

[SP] Caught an Exception: 
Traceback (most recent call last): 
  File '..\addons\source-python\plugins\infoweapontest\infoweapontest.py', line 10, in on_take_damage 
    info.weapon 

ValueError: Conversion from 'BaseHandle' (<_entities.BaseEntityHandle object at 0x251F8EF8>) to 'Index' failed. 

when a player shoots another player

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions