Im trying to detect market garden via SDKHooks. The code I made works in a sketchy way, sometimes it can detect it, but sometimes even if it does not detect it at all, but its still counts a market garden.
Code:
public Action Hook_OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3], int damagecustom)
{
if(IsValidClient(victim) && IsValidClient(attacker) && victim != attacker)
{
if(GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex") == 416)
{
if(TF2_IsPlayerInCondition(attacker, TFCond_BlastJumping))
{
// its a market garden, do things
}
else if(damagetype & DMG_CRIT || damagetype == DMG_CRIT)
{
// its a market garden, do things
}
}
}
return Plugin_Continue;
}
__________________