Csgo OnTakeDamage

Please post any questions about developing your plugin here. Please use the search function before posting!
cssbestrpg
Senior Member
Posts: 287
Joined: Sun May 17, 2020 7:56 am
Location: Finland
Contact:

Csgo OnTakeDamage

Postby cssbestrpg » Fri Jul 24, 2020 12:00 pm

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):
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Csgo OnTakeDamage

Postby Ayuto » Fri Jul 24, 2020 12:51 pm

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!
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Csgo OnTakeDamage

Postby Ayuto » Fri Jul 24, 2020 6:14 pm

A new version is now available on the download page.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 21 guests