Skip to content
RustPluginGenerator

CanBeWounded

CanBeWounded is called from BasePlayer.EligibleForWounding when the game decides whether a player can be put into the wounded (downed) state instead of dying.

Signature
object CanBeWounded(BasePlayer player, HitInfo info)

Parameters

Hook parameters
ParameterTypeDescription
playerBasePlayerThe BasePlayer that is about to be checked for eligibility to enter the wounded state. Use it to read health, team, permissions or mounted state.
infoHitInfoThe HitInfo describing the damage that triggered the check. Read damageTypes, Initiator, InitiatorPlayer and isHeadshot to tell lethal hits apart from bleed or fall damage.

Return value

Return false to prevent the player from being wounded so the hit kills them, return true to allow wounding (the game still applies the remaining wounding conditions), or return null to fall through to vanilla logic. Only a bool return is used; anything else is ignored.

How it works

The hook fires inside BasePlayer.EligibleForWounding, which the server calls while resolving a lethal hit on a player. That makes it run right before the wounded state is applied or skipped, so it is the correct place to make a player immune to downing. The player argument is the victim, and info is the HitInfo that caused the damage, giving you the damage type, the attacker (InitiatorPlayer), weapon distance and headshot flag.

Returning a bool overrides the game's own answer: false makes the player die outright, true forces the wounded state (subject to the remaining wounding checks that still run afterwards). Returning null keeps vanilla behavior. You cannot narrow this hook by declaring a more specific player type; the argument is always the victim and narrowing only makes Oxide skip calls.

Because it runs on every potential downing, keep the body cheap: no Puts, no PrintWarning, no allocation-heavy logic. Use permissions or a stored flag to decide immunity rather than querying data files on each call.

Example plugin: Make admins and a permission group immune to being downed

NoWoundAdmins.cs
using System.Collections.Generic;
using System;
using Newtonsoft.Json;
using Oxide.Core;

namespace Oxide.Plugins
{
    [Info("No Wound Admins", "RustPluginGenerator", "1.0.0")]
    [Description("Makes admins and a permission group immune to the wounded state so lethal hits kill them outright.")]
    public class NoWoundAdmins : RustPlugin
    {
        private const string PermImmune = "nowoundadmins.immune";

        private PluginConfig config;

        private class PluginConfig
        {
            [JsonProperty("Make admins immune")]
            public bool AdminsImmune { get; set; } = true;

            [JsonProperty("Make permission holders immune")]
            public bool PermissionImmune { get; set; } = true;
        }

        protected override void LoadDefaultConfig() => config = new PluginConfig();

        protected override void LoadConfig()
        {
            base.LoadConfig();
            try
            {
                config = Config.ReadObject<PluginConfig>();
                if (config == null) throw new Exception();
            }
            catch
            {
                PrintWarning("Configuration file is invalid, using defaults");
                LoadDefaultConfig();
            }
            SaveConfig();
        }

        protected override void SaveConfig() => Config.WriteObject(config);

        protected override void LoadDefaultMessages()
        {
            lang.RegisterMessages(new Dictionary<string, string>
            {
                ["ImmuneOn"] = "Wound immunity is now enabled for you.",
                ["ImmuneOff"] = "Wound immunity is now disabled for you.",
                ["NoPermission"] = "You are not allowed to use this command."
            }, this);
        }

        private string Msg(string key, string userId = null, params object[] args)
        {
            return string.Format(lang.GetMessage(key, this, userId), args);
        }

        private void Init()
        {
            permission.RegisterPermission(PermImmune, this);
        }

        [ChatCommand("woundimmune")]
        private void CmdWoundImmune(BasePlayer player, string command, string[] args)
        {
            if (player == null) return;

            if (!player.IsAdmin && !permission.UserHasPermission(player.UserIDString, PermImmune))
            {
                SendReply(player, Msg("NoPermission", player.UserIDString));
                return;
            }

            if (permission.UserHasPermission(player.UserIDString, PermImmune))
            {
                permission.RevokeUserPermission(player.UserIDString, PermImmune);
                SendReply(player, Msg("ImmuneOff", player.UserIDString));
            }
            else
            {
                permission.GrantUserPermission(player.UserIDString, PermImmune, this);
                SendReply(player, Msg("ImmuneOn", player.UserIDString));
            }
        }

        private object CanBeWounded(BasePlayer player, HitInfo info)
        {
            if (player == null || player.IsNpc) return null;

            if (config.AdminsImmune && player.IsAdmin) return false;

            if (config.PermissionImmune && permission.UserHasPermission(player.UserIDString, PermImmune)) return false;

            return null;
        }
    }
}

The plugin registers a single permission, nowoundadmins.immune, and answers CanBeWounded with false for players who hold it or are server admins. Returning false from the hook makes EligibleForWounding return false, so the victim is killed by the hit instead of entering the wounded state. Configuration exposes a toggle for admin immunity so server owners can turn it off without rebuilding. A boolean switch in the config controls whether the permission check is active at all. No chat output happens inside the hook; the only message a player gets is a short reply when they toggle immunity themselves through the chat command, which is registered for admins only.

Common use cases

  • Immunity for staff

    Stop admins and moderators from being downed while they handle reports, so they cannot be taken hostage during a situation.

  • PvP arena rules

    Return false for players inside an arena zone so duels end in a real kill instead of a downed state that spectators can abuse.

  • Boss or event characters

    Force players flagged as event participants to die outright so an event round cannot be stalled by repeated revives.

Pitfalls

  • Returning true does not guarantee the wounded state

    After the hook, the server still checks woundingenabled, damage types and other conditions. Returning true only means your plugin did not veto it.

  • Not every hit reaches this hook

    Only damage that would otherwise kill the player funnels into EligibleForWounding. Normal non-lethal damage never calls the hook, so do not use it as a general damage event.

  • Keep the body lightweight

    The hook runs during combat resolution. Avoid logging, file access and LINQ inside it; cache any per-player state you need.

Build a plugin with CanBeWounded

Describe what should happen and get a compiled plugin that uses this hook.

Prompt: Immunity for staff using the CanBeWounded hook, with a config file and a permission
Generate this plugin

Edit the prompt on the next screen. 2 free plugins a month, no card.

Last updated Oct 26, 2026. Found a mistake? Email support@rustplugingenerator.com.

Build a plugin with CanBeWounded

Generate