Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TakeDamageInfo.attacker raises ValueError: Conversion from "BaseHandle" (...) to "Index" failed. #350

Closed
Xiazee opened this issue Sep 22, 2020 · 1 comment · Fixed by #352

Comments

@Xiazee
Copy link

Xiazee commented Sep 22, 2020

This issue seems to be similar to #127

The following code:

from entities import TakeDamageInfo
from entities.hooks import EntityCondition, 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.attacker

Causes this exception when you shoot someone:

[SP] Caught an Exception:
Traceback (most recent call last):
  File "..\addons\source-python\plugins\testhook\testhook.py", line 9, in on_take_damage
    info.attacker

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

The other properties documented here do not raise any exceptions:
http://wiki.sourcepython.com/developing/modules/entities.html#entities.TakeDamageInfo

sp info

IMPORTANT: Please copy the full output.
--------------------------------------------------------
Checksum      : 1c85222c92fd172ecb743999bddb2e97
Date          : 2020-09-22 11:09:42.049044
OS            : Windows-10-10.0.19041
Game          : csgo
SP version    : 700
Github commit : 53f3bb562a2975c828d4c5145e21979859f57731
Server plugins:
   00: Source.Python, (C) 2012-2020, Source.Python Team.
SP plugins:
   00: testhook
--------------------------------------------------------
@Xiazee Xiazee changed the title TakeDamageInfo.attacker raises ValueError Conversion from "BaseHandle" (...) to "Index" failed. TakeDamageInfo.attacker raises ValueError: Conversion from "BaseHandle" (...) to "Index" failed. Sep 22, 2020
@CookStar
Copy link
Contributor

CookStar added a commit to CookStar/Source.Python that referenced this issue Sep 23, 2020
@jordanbriere jordanbriere linked a pull request Sep 23, 2020 that will close this issue
jordanbriere pushed a commit that referenced this issue Sep 25, 2020
* Fix #350, Updated CTakeDamageInfo wrapper for CS:GO.

* Changed get_attacker to return m_CSGOAttacker.m_iClientIndex.

* Updated m_CSGOAttacker.m_bIsWorld.

* Deleted external variables.
CookStar added a commit to CookStar/Source.Python that referenced this issue Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants