View Single Post
Yeef
Member
Join Date: Jun 2011
Old 10-15-2011 , 04:42   Re: SuperLogs: TF2 2.0.22 (updated 2010-11-08)
Reply With Quote #95

I realize this thread is pretty dead, but hopefully someone with an answer will see this. I'm looking for a way to tracking healing by medics and give out awards for it. I see this earlier in the thread:

Quote:
Originally Posted by TheLittleBrownDog View Post
If we wanted to award people points for healing x number of health (say 1000), I'd assume we'd use the 'healed' trigger, but how would we set that up?

EDIT: Okay, we figured out that 'healed' just gives you a point when you die if you healed any health as a non-Medic. Is there still any way we could do what I asked for above?
Quote:
Originally Posted by Kevin_b_er View Post
There's the "medic_death" event which has how much the medic healed in that life.
But with no real explanation.

Skimming the source, "medic_death" does seem to trigger the logging of heal points, but I don't see any way to record them to the database for the purposes of applying awards. As far as I can tell the keyword should be "healed," but that hasn't been working for us.

Is there any way to log the heal points as an action without editing the source?

The areas of interest are listed below; DumpHeals and LogPlayerEvent especially:

Code:
// Heals
new healPoints[MAXPLAYERS+1];

...

cvar_heals = CreateConVar("superlogs_heals", "1", "Enable logging of healpoints upon death (default on)", 0, true, 0.0, true, 1.0);

...

public Event_MedicDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    healPoints[client] = GetEntProp(client, Prop_Send, "m_iHealPoints");
}

...

DumpHeals(client, String:addProp[] = "")
{
    new curHeals = GetEntProp(client, Prop_Send, "m_iHealPoints");
    new lifeHeals = curHeals - healPoints[client];
    if(lifeHeals > 0)
    {
        decl String:szProperties[32];
        Format(szProperties, sizeof(szProperties), " (healing \"%d\")%s", lifeHeals, addProp);
        LogPlayerEvent(client, "triggered", "healed", _, szProperties);
    }
    healPoints[client] = curHeals;
}

...

public OnConVarHealsChange(Handle:cvar, const String:oldVal[], const String:newVal[])
{
    new bool:newval = GetConVarBool(cvar_heals);
    if(newval != b_heals)
    {
        if(newval)
        {
            HookEvent("medic_death", Event_MedicDeath);
            for(new i = 1; i <= MaxClients; i++)
                if(IsClientInGame(i))
                    healPoints[i] = GetEntProp(i, Prop_Send, "m_iHealPoints");
        }
        else
        {
            UnhookEvent("medic_death", Event_MedicDeath);
        }
        b_heals = newval;
    }
}
Yeef is offline