OnRidableAnimalClaimed
OnRidableAnimalClaimed is called after a player claims a purchasable RidableHorse (a horse bought with a purchase token) and is mounted onto it. It fires at the end of RidableHorse.SERVER_Claim, after the token is consumed and the player is seated.
void OnRidableAnimalClaimed(RidableHorse ridableHorse, BasePlayer player)Parameters
| Parameter | Type | Description |
|---|---|---|
ridableHorse | RidableHorse | The RidableHorse entity that was just claimed. Use it for position, owner, ShortPrefabName, or to read the animal's identity and any custom metadata (e.g. skin). |
player | BasePlayer | The BasePlayer who paid the purchase token and claimed the horse. The player is mounted onto the animal right before this hook fires, so their position already matches the animal. |
Return value
The return value is ignored. Returning null, true, or any other value does not stop the claim, unmount the player, refund the token, or otherwise change the outcome of SERVER_Claim.
How it works
This hook fires inside RidableHorse.SERVER_Claim, the server method that runs the buy-a-horse flow. By the time the hook is called, the purchase token item has already been used, the analytics event has been recorded, and AttemptMount has seated the player on the animal. The hook runs on the server only and is not called from any other code path, so it is specific to token-based claiming rather than general mounting or ownership transfers.
Use ridableHorse to inspect the claimed entity: its OwnerID, net.ID.Value, transform.position, ShortPrefabName, and skinID. Use player for the claimer's identity, team, and inventory state. Because the player is already mounted, their current mounted entity points at the animal.
The return value is ignored. You cannot cancel or modify the claim from this hook; to block a claim before it completes, use OnRidableAnimalClaim, which runs earlier in the same flow. Declaring more specific parameter types narrows when Oxide dispatches the hook, though the game only passes a RidableHorse and a BasePlayer here.
Example plugin: Announce claimed horses and log claims to data
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;
using UnityEngine;
namespace Oxide.Plugins
{
[Info("Ridable Animal Claim Announcer", "RustPluginGenerator", "1.0.0")]
[Description("Announces claimed purchasable horses in chat and logs claim counts per player.")]
public class RidableAnimalClaimAnnouncer : RustPlugin
{
private const string PermBypass = "ridableanimalclaimannouncer.bypass";
private PluginConfig config;
private Dictionary<string, int> claimCounts = new Dictionary<string, int>();
private class PluginConfig
{
[JsonProperty("Broadcast claims to chat")]
public bool Broadcast { 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>
{
["ClaimBroadcast"] = "{0} just claimed a {1}!",
["ClaimSelf"] = "You claimed a {1}. That is claim number {2} for you."
}, 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(PermBypass, this);
}
private void OnServerInitialized()
{
claimCounts = Interface.Oxide.DataFileSystem.ReadObject<Dictionary<string, int>>(Name) ?? new Dictionary<string, int>();
}
private void OnRidableAnimalClaimed(RidableHorse ridableHorse, BasePlayer player)
{
if (ridableHorse == null || player == null) return;
if (!player.IsConnected || permission.UserHasPermission(player.UserIDString, PermBypass)) return;
int count = 0;
var id = player.UserIDString;
claimCounts.TryGetValue(id, out count);
count++;
claimCounts[id] = count;
var animalName = ridableHorse.ShortPrefabName ?? "horse";
if (config.Broadcast)
{
Server.Broadcast(Msg("ClaimBroadcast", null, player.displayName, animalName));
}
SendReply(player, Msg("ClaimSelf", id, player.displayName, animalName, count));
}
private void Unload()
{
Interface.Oxide.DataFileSystem.WriteObject(Name, claimCounts);
}
}
}The plugin fires whenever a player claims a purchasable horse. It reads both parameters, builds a localized broadcast from the animal's short prefab name and skin, and sends it to chat. It also tracks a per-player claim counter in memory and persists the totals to oxide/data so admins can review activity across restarts. The claim data is written on each claim using Interface.Oxide.DataFileSystem, and Unload flushes once more. A config toggle lets you disable the broadcast while keeping logging. Messages go through the language API rather than hard-coded strings.
Common use cases
Broadcast purchases to chat
Tell the server when someone buys a horse so other players see the activity. Combine the player display name with the animal's short prefab name.
Track horse purchases per player
Record each claim against the player's UserIDString in oxide/data to reward repeat buyers, audit spend, or flag suspicious bursts of claims.
Tag newly claimed animals
Apply a custom skin, name tag, or stored metadata keyed by net.ID.Value so staff can identify purchased horses in-game.
Pitfalls
Cannot cancel the claim here
The token is already consumed and the player is already mounted when this hook fires. Use OnRidableAnimalClaim if you need to block the purchase before it completes.
Player may disconnect immediately after
If the player drops right after claiming, they can be invalid or destroyed shortly after. Null-check the player and avoid holding references to them across timers.
Not a general mount or ownership hook
Only token purchases fire this hook. Manual mounts, ownership transfers, and server-spawned horses do not. Use OnEntityMounted for mounting or OnRidableAnimalClaim for pre-purchase, and consider OnEntityDeath for cleanup.
Build a plugin with OnRidableAnimalClaimed
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 OnRidableAnimalClaimed
Generate