[L4D2] Survivor Inaccaracy after Infected Hit Off Console Command?
Where is the command for this? if there isnt a cvar for it can someone make a quick plugin that disables all survivor inaccuracy after an infected hit.
This can be achieved by patching the call to "CBasePlayer::SetPunchAngle" inside "CTerrorPlayer::OnTakeDamage_Alive". If you go with the method of changing the survivor's "m_vecPunchAngle" netprop, the screen will be jittery after each hit.
L4D1:
Spoiler
Gamedata:
PHP Code:
/**
* CTerrorPlayer::OnTakeDamage_Alive(CTakeDamageInfo const&)
*
* Note: Patches the "CBasePlayer::SetPunchAngle" function call.
*
* How to find:
* 1. Look for two calls to the "RandomFloat" function.
* 2. The first function call after that should be "CBasePlayer::SetPunchAngle".
* 3. That is the patch location.
**/
"CTerrorPlayer::OnTakeDamage_Alive::PunchAngle"
{
"linux" "3521" // start at E8 and patch 5 bytes with NOPs (0x90)
"mac" "2788" // start at E8 and patch 5 bytes with NOPs (0x90)
"windows" "1975" // start at 8D and patch 2 bytes with a short jump (0xEB) to skip instruction
}
/**
* CTerrorPlayer::OnTakeDamage_Alive(CTakeDamageInfo const&)
*
* How to find on Windows:
* 1. Find the function's offsets with asherkin's VTable dump.
* 2. Use IDA to get the VTable dump for the "CTerrorPlayer" class on Windows.
* 3. Compare your dump's offsets with asherkin's dump's offsets to find the target function.
* 4. Look for the target function in the Windows binary.
**/
"CTerrorPlayer::OnTakeDamage_Alive"
{
"library" "server"
"linux" "@_ZN13CTerrorPlayer18OnTakeDamage_AliveERK15CTakeDamageInfo"
"mac" "@_ZN13CTerrorPlayer18OnTakeDamage_AliveERK15CTakeDamageInfo"
"windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x83\x2A\x2A\x8B\x2A\x0F\x84"
/* ? ? ? ? ? ? ? ? ? 8B ? ? 83 ? ? 8B ? 0F 84 */
}
/**
* CTerrorPlayer::OnTakeDamage_Alive(CTakeDamageInfo const&)
*
* Note: Patches the "CBasePlayer::SetPunchAngle" function call.
*
* How to find:
* 1. Look for two calls to the "RandomFloat" function.
* 2. The first function call after that should be "CBasePlayer::SetPunchAngle".
* 3. That is the patch location.
**/
"CTerrorPlayer::OnTakeDamage_Alive::PunchAngle"
{
"linux" "4947" // start at E8 and patch 5 bytes with NOPs (0x90)
"mac" "4003" // start at E8 and patch 5 bytes with NOPs (0x90)
"windows" "2830" // start at 8D and patch 2 bytes with a short jump (0xEB) to skip instruction
}
/**
* CTerrorPlayer::OnTakeDamage_Alive(CTakeDamageInfo const&)
*
* How to find on Windows:
* 1. Find the function's offsets with asherkin's VTable dump.
* 2. Use IDA to get the VTable dump for the "CTerrorPlayer" class on Windows.
* 3. Compare your dump's offsets with asherkin's dump's offsets to find the target function.
* 4. Look for the target function in the Windows binary.
**/
"CTerrorPlayer::OnTakeDamage_Alive"
{
"library" "server"
"linux" "@_ZN13CTerrorPlayer18OnTakeDamage_AliveERK15CTakeDamageInfo"
"mac" "@_ZN13CTerrorPlayer18OnTakeDamage_AliveERK15CTakeDamageInfo"
"windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x53\x8B\x2A\x2A\x56\x8B\x2A\x8B\x2A\x2A\x57\x83\x2A\x2A\x74"
/* ? ? ? ? ? ? ? ? ? 53 8B ? ? 56 8B ? 8B ? ? 57 83 ? ? 74 */
}