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
CS:S, Windows
The following code
produces the following exception
when a player shoots another player