Skip to content

Friendly hits, with mp_friendlyfire 0 #348

Answered by saul
justMemou asked this question in Questions
Discussion options

You must be logged in to vote

I've spent a few hours coming up with a solution. It works by tracking when the Impact effect is dispatched. This effect is dispatched when players are hit, even if they are hit by teammates when mp_friendlyfire = 0. It is responsible for adding the blood decal to player models when they've been shot.

Unfortunately it is quite difficult to calculate who the attacker was, because the player positions are affected by lag compensation. To workaround this, the solution below works when just one player shoots in a given tick. Two or more players shooting on the exact same tick is uncommon, but it does happen, so this solution won't work 100% of the time. With that said it should get you most o…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by saul
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants