Detect if bullet hit the player - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Detect if bullet hit the player (
/showthread.php?tid=451066)
Detect if bullet hit the player -
Twizted - 15.07.2013
I honestly fear to make these kind of threads in this section, but I haven't found thread that actually explains how to detect if the bullet hit the player - in other terms, detect if the player was shot.
My plan was to play a sound effect for the shooter as the bullet hits the player (no specific area of the body), and a sound effect for the player that was hit.
Re: Detect if bullet hit the player -
IstuntmanI - 15.07.2013
https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage
Re: Detect if bullet hit the player -
Misiur - 15.07.2013
https://sampwiki.blast.hk/wiki/OnPlayerGiveDamage
Read the big orange box
Re: Detect if bullet hit the player -
IstuntmanI - 15.07.2013
You should use OnPlayerTakeDamage, because it is called when the damaged player receives damage on his screen.
OnPlayerGiveDamage is called when the issuer id gives damage on his screen, it could be called when the damaged player doesn't "see" on his screen the bullet (for example this callback is called when you shoot an AFK player and you don't give damage actually, but OnPlayerTakeDamage isn't called).
Re: Detect if bullet hit the player -
Twizted - 15.07.2013
Thank you, both of you have helped me a bunch. I cannot add reputation to you'se at this time but I'll make sure to do so. Thanks IstuntmanI and Misiur.