'get_healing_target' SHOULD return the heal-player of the player's medigun
Then there's 'is_near_dispenser' which checks to see how much stuff is healing the player and sorting it out whether it's from medics or not.
Thus, it works very nicely to determine if it's really from a dispenser or not.
Hopefully these code examples will work with no error. Happy Coding!
Syntax: Select all
def get_healing_target(client): #need player for
medigun = client.get_secondary()
if medigun is None:
return None
if medigun.classname() == "tf_weapon_medigun":
if medigun.get_property_bool('m_bHealing'):
return medigun.get_property_edict('m_hHealingTarget')
return None
Syntax: Select all
def is_near_dispencer(client):
medics = 0
healers = client.get_property_int('m_nNumHealers')
if healers > 0:
for i in range(1, 34):
player = PlayerEntity(i)
if ( player is not None and not player.isdead and get_healing_target(player).userid == client.userid ):
medics += 1
return healers > medics