set the activator for func_button OnDamage output

This commit is contained in:
Joe 2021-03-29 12:28:22 +00:00 committed by GitHub
parent 3f55e0a7dc
commit 5978fe6153
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -151,6 +151,14 @@ public void OnClientDisconnect(int client)
}
}
public void OnEntityCreated(int entity, const char[] classname)
{
if (StrEqual(classname, "func_button"))
{
SDKHook(entity, SDKHook_OnTakeDamage, Hook_Button_OnTakeDamage);
}
}
void LoadDHooks()
{
GameData gamedataConf = LoadGameConfigFile("eventfix.games");
@ -344,6 +352,15 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
}
}
public Action Hook_Button_OnTakeDamage(int victim, int& attacker, int& inflictor, float& damage, int& damagetype, int& weapon, float damageForce[3], float damagePosition[3], int damagecustom)
{
// func_button fires the OnDamage output before setting m_hActivator to the attacker.
// This means m_hActivator can be unset or a previous attacker.
// This is a problem at bhop_badges level 13 and also the booster in the ladder room.
SetEntPropEnt(victim, Prop_Data, "m_hActivator", attacker);
return Plugin_Continue;
}
public any Native_GetClientEvents(Handle plugin, int numParams)
{
int client = GetNativeCell(1);