Skip to content
RustPluginGenerator

CanRagdollDismount

CanRagdollDismount is called when a player attempts to dismount from a ragdoll (for example a corpse they are carrying or dragging). Returning a non-null value overrides whether the dismount is allowed.

Signature
object CanRagdollDismount(BaseRagdoll ragdoll, BasePlayer player)

Parameters

Hook parameters
ParameterTypeDescription
ragdollBaseRagdollThe BaseRagdoll the player is trying to dismount from. Useful for checking its position, owner, or the entity it belongs to.
playerBasePlayerThe BasePlayer requesting the dismount. Check permissions, team membership, or zone rules against this player.

Return value

If any plugin returns a bool, that value becomes the result of AllowPlayerInstigatedDismount and controls whether the dismount succeeds. Returning null (or any non-bool value) lets the call fall through to the game default, which is false — the dismount is denied.

How it works

This hook fires from BaseRagdoll.AllowPlayerInstigatedDismount, which the game calls when a player tries to detach themselves from a ragdoll. The BaseRagdoll argument is the ragdoll being dismounted, and player is the player making the request. Use it to gate the action by permission, region, combat state, or team ownership of the corpse.

Declaring player as a more specific type such as BasePlayer is already the signature; narrowing further (to a subclass) would make Oxide skip calls for other player types, so keep BasePlayer here. You can also register a separate object CanRagdollDismount(BaseRagdoll ragdoll, BasePlayer player) method — the signature is fixed.

The game's own default is to deny the dismount when no hook result is returned, so a plugin that only wants to allow normally must actively return true. That means every dismount attempt on your server flows through your hook result whenever the plugin is loaded. Keep the method cheap: check the player, decide, and return.

Example plugin: Permit ragdoll dismount only for permitted players

RagdollDismountGate.cs
using System;
using Oxide.Core;
using UnityEngine;

namespace Oxide.Plugins
{
    [Info("Ragdoll Dismount Gate", "RustPluginGenerator", "1.0.0")]
    [Description("Restricts ragdoll dismounts to players holding a permission.")]
    public class RagdollDismountGate : RustPlugin
    {
        private const string PermAllow = "ragdolldismountgate.allow";

        private DateTime lastWarning = DateTime.MinValue;

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

        private object CanRagdollDismount(BaseRagdoll ragdoll, BasePlayer player)
        {
            if (player == null || ragdoll == null)
                return null;

            if (player.IsAdmin || permission.UserHasPermission(player.UserIDString, PermAllow))
                return true;

            // Rate-limited notice so we do not spam the console during events.
            if ((DateTime.UtcNow - lastWarning).TotalSeconds >= 10.0)
            {
                lastWarning = DateTime.UtcNow;
                PrintWarning($"Denied ragdoll dismount for {player.displayName} ({player.UserIDString})");
            }

            return false;
        }
    }
}

The plugin registers a single permission, ragdolldismountgate.allow, and adds an admin bypass so server staff do not need to grant it. In CanRagdollDismount, it null-checks the ragdoll and player, then returns true only when the player has the permission or is an admin. Everyone else gets false, which matches the game default of denying the dismount. Because the default is denial, an unloaded plugin blocks dismounts entirely; the plugin's purpose is to make dismounts available to a controlled group and log a rate-limited warning when access is refused.

Common use cases

  • Restrict corpse dragging to authorised players

    Gate dismounts so only players with a specific permission or team role can release a ragdoll, preventing abuse during corpse-hauling events.

  • Disable dismounting in a protected zone

    Check the ragdoll position against a monument or event area and deny the dismount while the player is inside it.

  • Audit dismount attempts

    Track which players repeatedly attempt to dismount from ragdolls they do not own and forward the data to your moderation tooling.

Pitfalls

  • Default is denial

    The game returns false when no hook result is supplied, so a plugin that returns nothing blocks every dismount. Always return an explicit bool from the hook.

  • No live ragdoll guarantee

    ragdoll can be destroyed during the frame it is passed to the hook. Null-check it and avoid caching it beyond the call.

  • Nothing to do with mounts

    This hook only covers ragdolls, not vehicles or horses. Use CanMountEntity and CanDismountEntity for rideable entities.

Build a plugin with CanRagdollDismount

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

Prompt: Restrict corpse dragging to authorised players using the CanRagdollDismount 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 CanRagdollDismount

Generate