Page 1 of 1

Csgo OnTakeDamage

Posted: Fri Jul 24, 2020 12:00 pm
by cssbestrpg
Hi, after csgo newest update, the damage code hasn't work for me anymore. Console keep spamming

Code: Select all

[2020-07-24 14:44:02]: [SP] Caught an Exception:[2020-07-24 14:44:02]: Traceback (most recent call last):[2020-07-24 14:44:02]: File "../addons/source-python/plugins/rpg/rpg.py", line 1319, in pre_damage[2020-07-24 14:44:02]: if info.attacker == info.inflictor:[2020-07-24 14:44:02]: ValueError: Conversion from "BaseHandle" (<_entities.BaseEntityHandle object at 0xe9bfed68>) to "Index" failed.


OnTakeDamage code:

Syntax: Select all

@EntityPreHook(EntityCondition.is_player, 'on_take_damage')
def pre_damage(args):
index = index_from_pointer(args[0])
info = make_object(TakeDamageInfo, args[1])
chcc = C_CHANCE.get_float()
if info.attacker == info.inflictor:
_damage = info.damage
if info.type & 2:
try:
userid = rpglib.useridFromIndex(index)
except:
userid = None
if userid:
attacker = userid_from_inthandle(info.attacker)
attackerteam = rpglib.getTeam(attacker)

if attacker and attackerteam != rpglib.getTeam(userid):

Re: Csgo OnTakeDamage

Posted: Fri Jul 24, 2020 12:51 pm
by Ayuto
There was a change in the TakeDamageStructure. The hl2sdk has been already updated, so I will just need to recompile it later today. Thanks for reporting!

Re: Csgo OnTakeDamage

Posted: Fri Jul 24, 2020 6:14 pm
by Ayuto
A new version is now available on the download page.