1. cibal

    cibal Scavenger

    Is there any hook called when a player is wounded?
     
  2. Wulf

    Wulf Community Admin Community Admin Oxide Developer

  3. cibal

    cibal Scavenger

    I mean when you are wounded not when taking damage
     
  4. Reneb

    Reneb Plugin Developer

  5. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    If you just want to check if a player is wounded, you'd just need to find the check in Rust that stores that.
    --- Double Post Merged, Aug 15, 2015 ---
    I'm not sure that's what the OP wants.
     
  6. cibal

    cibal Scavenger

    the hook CanBeWounded just call the method when you start being wounded or return true when you are wounded?
    How does it works exactly?
     
  7. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    • Called from BasePlayer.EligibleForWounding
    • Returning true or false will cancel default behavior
    • Called when a player dies
     
  8. cibal

    cibal Scavenger

    So it is called only once when you start being wounded or when you die?
     
  9. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    From that description, when you die. You can detect if a player is wounded by checking the player with Rust itself, likely a player flag.
     
  10. cibal

    cibal Scavenger

    Too dificult for me since I dont know how rust works. I will try to find how does it works. Thanks
     
  11. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Code (C):
    player.IsWounded()
    Code (Lua):
    player:IsWounded()
    or

    Code (C):
    player.HasPlayerFlag(BasePlayer.PlayerFlags.Wounded)
    Code (Lua):
    player:HasPlayerFlag(BasePlayer.PlayerFlags.Wounded)
     
  12. cibal

    cibal Scavenger

    Ok thanks a lot
     
  13. Rebajas

    Rebajas Wood Hoarder

    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.
     
  14. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    That's all under HitInfo.
     
  15. Rebajas

    Rebajas Wood Hoarder

    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?
     
  16. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    You can see that under the Assembly-CSharp.dll for Rust using a decompiler such as JustDecompile. HitInfo is something Rust provides, not Oxide.

    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.
     
  17. NOP

    NOP Naked Wanderer

    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 (Text):
    void CanBeWounded(BasePlayer player, HitInfo info)
            {
                if (player.IsWounded() || player.HasPlayerFlag(BasePlayer.PlayerFlags.Wounded))
                {
                    Plugin.Puts("Wounded!");
                }
            }
     
  18. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Everything other than Plugin.Puts is right, it should just be Puts.
     
  19. NOP

    NOP Naked Wanderer

    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: Jan 8, 2017
  20. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Considering that CanBeWounded happens before they are actually wounded, you'll likely never pass that check. If you want to check if a player is wounded, check when they take damage or in another hook location.