OnEntityDismounted
OnEntityDismounted is called after a player is removed from a mountable entity such as a chair, vehicle seat or horse saddle. It fires at the end of BaseMountable.DismountPlayer.
void OnEntityDismounted(BaseMountable mountable, BasePlayer player)Parameters
| Parameter | Type | Description |
|---|---|---|
mountable | BaseMountable | The BaseMountable entity the player is leaving, such as a chair, horse saddle, minicopter seat or modular car seat. It is the entity whose DismountPlayer method fired. |
player | BasePlayer | The BasePlayer being dismounted. The hook runs after the player has already been detached from the mount, so use it to react to the dismount rather than to cancel it. |
Return value
The return value is ignored. The original DismountPlayer method continues and returns normally regardless of what your hook returns, so returning null, true or any other value has no effect on the dismount.
How it works
The hook fires inside BaseMountable.DismountPlayer, after the game finishes detaching the player from the seat and calls the internal OnPlayerDismounted callback. That method runs whenever a player leaves a mountable: pressing use to exit a chair, hopping out of a minicopter or modular car seat, dismounting a horse saddle, being forced off, or any other code path that calls DismountPlayer on the mountable. Both mountable and player are concrete object instances, so you can cast mountable to more specific types like BaseVehicleSeat, MiniCopter, ModularCar, or RidableHorse to narrow behavior. Declaring a more specific parameter type still works because Oxide only invokes your method when the argument matches; use it when you only care about a subset of mounts.
Because the hook fires after the player is detached, the player's position, mounted/isMounted state and any vehicle parenting already reflect the dismounted state. Use it for post-dismount effects: cooldowns, notifications, statistics, teleports, permission checks, or starting timers. Do not use it to block or alter the dismount itself, since the return value is ignored.
Example plugin: Cooldown chat notice after leaving a mount
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;
using Oxide.Core.Plugins;
using UnityEngine;
namespace Oxide.Plugins
{
[Info("Dismount Cooldown", "RustPluginGenerator", "1.0.0")]
[Description("Announces when a player dismounts and records the time for cooldown style features")]
public class DismountCooldown : RustPlugin
{
private const string PermUse = "dismountcooldown.use";
private PluginConfig config;
private readonly Dictionary<string, double> lastDismount = new Dictionary<string, double>();
private Timer cleanupTimer;
private class PluginConfig
{
[JsonProperty("Announce dismount in chat")]
public bool Announce = true;
[JsonProperty("Include mountable prefab name")]
public bool ShowMount = true;
[JsonProperty("Retention seconds")]
public float RetentionSeconds = 300f;
}
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>
{
["Dismounted"] = "You left the {0}.",
["DismountedPlain"] = "You dismounted.",
["Cooldown"] = "Last dismount was {0} seconds ago."
}, this);
}
private string Msg(string key, string userId = null, params object[] args)
=> string.Format(lang.GetMessage(key, this, userId), args);
private void Init()
{
permission.RegisterPermission(PermUse, this);
}
private void OnServerInitialized()
{
cleanupTimer = timer.Every(60f, PruneOldEntries);
}
private object OnEntityDismounted(BaseMountable mountable, BasePlayer player)
{
if (mountable == null || player == null) return null;
if (!permission.UserHasPermission(player.UserIDString, PermUse)) return null;
lastDismount[player.UserIDString] = Time.realtimeSinceStartup;
if (!config.Announce) return null;
if (config.ShowMount && !string.IsNullOrEmpty(mountable.ShortPrefabName))
{
player.ChatMessage(Msg("Dismounted", player.UserIDString, mountable.ShortPrefabName));
}
else
{
player.ChatMessage(Msg("DismountedPlain", player.UserIDString));
}
return null;
}
private void PruneOldEntries()
{
if (lastDismount.Count == 0) return;
double cutoff = Time.realtimeSinceStartup - config.RetentionSeconds;
List<string> stale = null;
foreach (var kvp in lastDismount)
{
if (kvp.Value < cutoff)
{
if (stale == null) stale = new List<string>();
stale.Add(kvp.Key);
}
}
if (stale == null) return;
foreach (var id in stale) lastDismount.Remove(id);
}
private void Unload()
{
cleanupTimer?.Destroy();
cleanupTimer = null;
lastDismount.Clear();
}
}
}The plugin records the last dismount time per player and prints a localized chat message when the player leaves a mountable. OnEntityDismounted reads the stored timestamp, formats it with Msg, and updates the entry. A timer.Once clears stale entries periodically to keep memory use bounded. The mountable parameter is used to display the mount's short prefab name, which is useful in the message. Only the player object from the hook is used for the chat output, and the plugin never tries to block or modify the dismount itself, since the return value is ignored.
Common use cases
Vehicle exit notifications
Tell teammates or nearby players when someone dismounts a minicopter or modular car seat, using the mountable's position for proximity checks.
Seat cooldown or countdown
Start a per-player timer after a dismount to gate re-entry via OnEntityMounted or a custom chat command.
Usage statistics
Increment counters per mountable type (horse, chair, car seat) to track player activity or feed into a rewards system.
Pitfalls
Runs after the player is detached
Do not rely on
player.isMountedor the mountable containing the player; the game has already removed the player from the seat by the time the hook runs.Called for every mountable type
Chairs, saddles, seats on aircraft and car seats all route through DismountPlayer. Cast or filter with
mountable as BaseVehicleSeat/MiniCopterwhen you only care about a subset.Cannot block the dismount
Returning a value does nothing; the injection uses the continue behavior. Use OnEntityMounted or a command handler if you need to prevent mounting.
Build a plugin with OnEntityDismounted
Describe what should happen and get a compiled plugin that uses this hook.
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 OnEntityDismounted
Generate