SA-MP Forums Archive
OnPlayerTakeDamage - 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: OnPlayerTakeDamage (/showthread.php?tid=579767)



OnPlayerTakeDamage - Baltimore - 29.06.2015

How not to lose health with OnPlayerTakeDamage?

I intended to play with the "amount" value, but for example if the player has 10 HP before being shot I can not reget him the value of amount , eg amount = 50 ... if he does not regain 10 HP .

++


Re: OnPlayerTakeDamage - Suicidal.Banana - 29.06.2015

return false


Re: OnPlayerTakeDamage - Abagail - 29.06.2015

I don't know why you think returning 0(or false) will stop the damage from being taken, it won't. It will stop the callback from being called in other scripts.


Re: OnPlayerTakeDamage - NiGHTM4RE714 - 29.06.2015

Use OnPlayerWeaponShot()

PHP код:

public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
     
// Your code here
     
return 0//Prevents the player from taking damage.




Re: OnPlayerTakeDamage - Suicidal.Banana - 30.06.2015

Quote:
Originally Posted by Abagail
Посмотреть сообщение
I don't know why you think returning 0(or false) will stop the damage from being taken, it won't. It will stop the callback from being called in other scripts.
ah, my mistake