Same here...
Merged post
See if this works...
using UnityEngine;
using Oxide.Core;
using Oxide.Core.Plugins;
namespace Oxide.Plugins
{
[Info("Whoa Boy", "Clearshot", "1.1.0")]
[Description("Stop horses from running away when you dismount")]
class WhoaBoy : CovalencePlugin
{
private PluginConfig _config;
private void Init()
{
permission.RegisterPermission("whoaboy.use", this);
}
void OnEntityDismounted(BaseVehicleSeat seat, BasePlayer player)
{
if (_config.usePermission && player != null && !permission.UserHasPermission(player.UserIDString, "whoaboy.use")) return;
if (seat == null) return;
RidableHorse horse = seat.GetParentEntity() as RidableHorse;
if (horse == null) return;
// Get current speed from rigidbody
float currentSpeed = horse.rigidBody.velocity.magnitude;
if (currentSpeed > 4f)
{
// Use the gait system to control movement
if (_config.stopType.Contains("stop"))
{
horse.currentGait = RidableHorse.GaitType.Walk;
horse.rigidBody.velocity = Vector3.zero;
}
else
{
horse.currentGait = RidableHorse.GaitType.Walk;
}
if (_config.stopType == "stopAndStand" && horse.CanStand())
horse.ClientRPC(null, "Stand");
}
else
{
horse.currentGait = RidableHorse.GaitType.Walk;
horse.rigidBody.velocity = Vector3.zero;
}
// Reset rotation if needed
horse.rigidBody.angularVelocity = Vector3.zero;
}
#region Config
protected override void LoadDefaultConfig()
{
Config.WriteObject(GetDefaultConfig(), true);
}
private PluginConfig GetDefaultConfig()
{
return new PluginConfig();
}
protected override void LoadConfig()
{
base.LoadConfig();
_config = Config.ReadObject<PluginConfig>();
}
private class PluginConfig
{
public bool usePermission = false;
public string stopType = "stop";
}
#endregion
}
}