Skip to content

Commit

Permalink
Fixed the Only Headshot LR hs verification
Browse files Browse the repository at this point in the history
  • Loading branch information
azalty committed Jul 10, 2023
1 parent d6aa9a4 commit f2fbcee
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions addons/sourcemod/scripting/hosties/lastrequest.sp
Original file line number Diff line number Diff line change
Expand Up @@ -2047,6 +2047,19 @@ public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &dam
{
if ((attacker == LR_Player_Guard && victim == LR_Player_Prisoner) || (attacker == LR_Player_Prisoner && victim == LR_Player_Guard))
{
if (damagetype & CS_DMG_HEADSHOT) // This is the right way to check for headshots, it will take into account the spread and recoil.
{
damage = 200.0; // Ensures it will kill
return Plugin_Changed;
}
else
{
return Plugin_Handled; // Prevents the shot from counting, removing the slowdown effect and bullet punch.
}

// Tracing a ray is not the way, as bullets don't always go to the center of the crosshair, especially with recoil, spread, and movement.

/* HERE LIES THE OLD METHOD
GetClientEyePosition(attacker, start);
GetClientEyeAngles(attacker, ang);
Expand All @@ -2060,6 +2073,7 @@ public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &dam
return Plugin_Changed;
}
EMP_FreeHandle(hTrace);
*/
}
}
case LR_HEFight:
Expand Down

0 comments on commit f2fbcee

Please sign in to comment.