Preventing from getting damaged?Solved
To cancel the dammage being dealth to the player return 0:
object OnPlayerTakeDamage(PlayerSession session, EntityEffectSourceData source){
return 0f;
} MrBlue
To cancel the dammage being dealth to the player return 0:
object OnPlayerTakeDamage(PlayerSession session, EntityEffectSourceData source){ return 0f;}
Thank you ! Do you know if there is a OnDamage event ? (as it doesn't seems to be one in the doc maybe there is one but not listed)
If not, that's ok, I'll do an other way ^^
ZeTioZThank you ! Do you know if there is a OnDamage event ? (as it doesn't seems to be one in the doc maybe there is one but not listed)
If not, that's ok, I'll do an other way ^^
What do you mean by OnDamage event? There is the OnPlayerTakeDamage hook and the OnEntityTakeDamage hook.
MrBlue
What do you mean by OnDamage event? There is the OnPlayerTakeDamage hook and the OnEntityTakeDamage hook.
I mean an event while the player Damage something and not get damaged for example if I just want to know where the attacker is, get his position and prevent him from dealing damage if he can't deal damage in his area ^^ but if there is not, I'll just need to check the damage source from the taken damage and make the same checks so it's not too anoying ^^
ZeTioZI mean an event while the player Damage something and not get damaged for example if I just want to know where the attacker is, get his position and prevent him from dealing damage if he can't deal damage in his area ^^ but if there is not, I'll just need to check the damage source from the taken damage and make the same checks so it's not too anoying ^^
There is no hook to do such thing, but it's perfectly doable with the 2 hooks i just mentioned. Take a look at my CustomDeathMessages plugin on how to get the attacker PlayerSession: https://umod.org/plugins/custom-death-messages
MrBlue
There is no hook to do such thing, but it's perfectly doable with the 2 hooks i just mentioned. Take a look at my CustomDeathMessages plugin on how to get the attacker PlayerSession: https://umod.org/plugins/custom-death-messages
Nice thank you it will save me some debugging time ;)
PS: The code was very clear, easy to understand thanks a lot ;)