Yeah; I just used Attribute #16 for hits. The trick was tying a function to when something
didn't happen~
I hooked TF2_CalcIsAttackCritical, per Turt's suggestion, and ended up with this:
PHP Code:
public Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[],
&bool:result) {
if(!IsValidEntity(weapon)) return Plugin_Continue;
new wIndex = GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex");
if(wIndex == 41) {
NataschaPunishments[client] += 0.3;
}
return Plugin_Continue;
}
public OnClientPutInServer(client) {
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamagePre);
}
public Action:OnTakeDamagePre(victim, &attacker, &inflictor, &Float:damage,
&damagetype, &weapon, Float:damageForce[3], Float:damagePosition[3]) {
if(!IsValidEntity(weapon)) return Plugin_Continue;
new wIndex = GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex");
if(wIndex == 41) {
if(damage >= 16) NataschaPunishments[attacker] -= 1.0;
else NataschaPunishments[attacker] -= 0.1;
}
return Plugin_Continue;
}
public OnGameFrame() {
for(new i = 1; i <= MaxClients; i++) {
if(!IsClientInGame(i) || !IsPlayerAlive(i)) {
NataschaPunishments[i] = 0.0;
continue;
}
if(NataschaPunishments[i] > 1.0) {
if(GetConVarBool(CvarVerbose)) {
PrintToChatAll("-%d for missing, baby!",
NataschaPunishments[i]);
}
new h = GetEntProp(i, Prop_Send, "m_iHealth");
SetEntProp(i, Prop_Send, "m_iHealth", h - 1);
NataschaPunishments[i] = 0.0;
}
}
}
This ended up working better than Attribute #204, ultimately. If #204
did decide to play nice, I wouldn't have been able to code in the nuance I needed for this new direction to work.