SA-MP Forums Archive
When hit a 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: When hit a player (/showthread.php?tid=106992)



When hit a player - Butilka - 07.11.2009

Hello! I have one idea. Maybe good, maybe not. So, when you shoot somebody and hit him, a TextDraw, SendClientMessage, GameText (no matter) says next " You hit player (blablabla) and decrease his health on (blablabla) points". Is it possible to do? If it is, help please. Tried to search, got nothing.


Re: When hit a player - Zeex - 07.11.2009

Well, I think this is possible but hard to script. I know only one way of doing that:
When player lose some health, you check all other players in a certain range from his position. If someone have a gun and this gun can do damage on such distance, and if his face is turned to that player, and he press KEY_FIRE or KEY_SECONDARY_ATTACK (correct me if I'm wrong), then POSSIBLY he has hit the player.
This is just theory.

For health checking you can use YUP by ****** (it has OnPlayerHealthChange callback), or something else.



Re: When hit a player - Tigerbeast11 - 07.11.2009

I dont think this is possible


P.S why would you wanna do this, itd spam the screen, lol!


Re: When hit a player - Butilka - 07.11.2009

Thanks. Maybe another thoughts will come.


Re: When hit a player - Backwardsman97 - 07.11.2009

Yeah, there really is no efficient way of doing this.


Re: When hit a player - Butilka - 07.11.2009

Hm...But I saw that is realisied at least on one server.


Re: When hit a player - Backwardsman97 - 07.11.2009

Yeah it can be done but not efficiently. So it would be buggy.


Re: When hit a player - Butilka - 08.11.2009

Yes, but you can try to do it, and I dont have even ad idea.


Re: When hit a player - Tigerbeast11 - 09.11.2009

There is a script called Useful Callbacks which contains a whole range of callabacks!

Including, OnPlayerLoseHealth!!!! Use that!


Re: When hit a player - saiberfun - 09.11.2009

Quote:
Originally Posted by Tigerbeast11
There is a script called Useful Callbacks which contains a whole range of callabacks!

Including, OnPlayerLoseHealth!!!! Use that!
well it doesnt have a shooter id^^
but it would be halfpossible to script this
but it wouldnn't be so correct anytime^^