24.05.2018, 10:15
The problem with that code is that you can still die from bodyshots if your health is lower or equal to the damage done.
If you don't yet use SAMP's team system in your mode (or minigame, where you use this) you can set all players' teams to the same team and then only process headshot damage (players will not be able to damage each other, except for the damage you specifically allow).
Furthermore this uses OnPlayerTakeDamage, so the headshot must be done on the target's screen. If you shoot someone's head but this doesn't happen on their screen as well, it won't work.
Use OnPlayerGiveDamage if you want it to be dependant on the shooter's hit position.
If you don't yet use SAMP's team system in your mode (or minigame, where you use this) you can set all players' teams to the same team and then only process headshot damage (players will not be able to damage each other, except for the damage you specifically allow).
Furthermore this uses OnPlayerTakeDamage, so the headshot must be done on the target's screen. If you shoot someone's head but this doesn't happen on their screen as well, it won't work.
Use OnPlayerGiveDamage if you want it to be dependant on the shooter's hit position.