Is there any hook called when a player is wounded?
Solved Detecting when player is wounded?
Discussion in 'Rust Development' started by cibal, Aug 15, 2015.
-
Wulf Community Admin
-
I mean when you are wounded not when taking damage
-
Wulf Community Admin
[DOUBLEPOST=1439596049][/DOUBLEPOST] -
the hook CanBeWounded just call the method when you start being wounded or return true when you are wounded?
How does it works exactly? -
Wulf Community Admin
- Called from BasePlayer.EligibleForWounding
- Returning true or false will cancel default behavior
- Called when a player dies
-
So it is called only once when you start being wounded or when you die?
-
Wulf Community Admin
-
Too dificult for me since I dont know how rust works. I will try to find how does it works. Thanks
-
Wulf Community Admin
Code:player.IsWounded()
Code:player:IsWounded()
Code:player.HasPlayerFlag(BasePlayer.PlayerFlags.Wounded)
Code:player:HasPlayerFlag(BasePlayer.PlayerFlags.Wounded)
-
Ok thanks a lot
-
Sorry to dig up an old thread, but what properties does info have on canbewounded? Most specifically, what weapon was used and who did it...?
Thanks in advance.
T. -
Wulf Community Admin
-
Hi Wulf, my question is *what* is the 'all' that is under HitInfo?
On a separate note, I am using CanBeWounded to announce deaths, but I noticed the other day that when a user recovers from a near death experience, the event triggers regardless i.e. when a player is laying on the ground sobbing like a girl, CanBeWounded has already announce their death. Can it only be trusted for signifying the death of someones dignity? -
Wulf Community Admin
CanBeWounded is not a good location for death announcements, that is triggered before they die most of the time. I'd suggest using OnPlayerDie instead. -
Does this still work? I am falling from a large height to try and trigger the "Wounded" message with the code below -- to no avail
Code:void CanBeWounded(BasePlayer player, HitInfo info) { if (player.IsWounded() || player.HasPlayerFlag(BasePlayer.PlayerFlags.Wounded)) { Plugin.Puts("Wounded!"); } }
-
Wulf Community Admin
-
Thanks for your response Wulf
That's not the issue tho, because the Puts works ( When I print my player flags to console, I only ever see IsConnected and IsAsmin. Never Wounded, etc.) I wonder If another plugin is causing collisions......
Edit: The only plugins I have which touch "CanBeWounded" is the KillFeed plugin, and it dosent seem like It would prevent my code from working? I even tried unloading all plugins that I thought might be colliding.....I think it must be something else....Last edited by a moderator: Jan 8, 2017 -
Wulf Community Admin