Skip to content
RustPluginGenerator

OnEngineStart

OnEngineStart is called when a player tries to start the engine of a boat or a vehicle mountable, before the engine flags are set or the boat's engine is turned on. Returning a non-null value cancels the start.

Signature
object OnEngineStart(SmallEngine smallEngine, BasePlayer player)

Parameters

Hook parameters
ParameterTypeDescription
smallEngineSmallEngineThe entity the engine belongs to at the point of the call: a SmallEngine when the engine is toggled from a boat's engine control, a MotorRowboat when the driver presses the engine toggle, or the mountable acting as owner in VehicleEngineController.TryStartEngine. Declare the parameter as BaseEntity or the specific type you need.
playerBasePlayerThe BasePlayer trying to start the engine. It is the RPC sender on SmallEngine, the current driver on MotorRowboat, and the requesting player in VehicleEngineController; it can be null, so always null-check it.

Return value

Return null (or nothing) to let the engine start proceed exactly as vanilla. Return any non-null value to stop the original code path, so the engine flags are not set and SmallEngine.TurnOn() is not called. The object you return is not used as a value, only its null-ness matters.

How it works

The hook fires at three places. In SmallEngine.TurnOn it runs after the client RPC is received but before fuel and authorization are checked, so it fires even when the boat has no fuel or the player is not authed. In MotorRowboat.EngineToggle it runs after the fuel check but before the Flags.On flag is set on the boat. In VehicleEngineController.TryStartEngine it runs after a successful CanRunEngine check and before the starting flag is set on the owning mountable, which covers modular cars, minicopters and similar vehicles.

The first argument is the entity that owns the engine, not always a literal SmallEngine. Because Oxide only calls your method when each argument matches your declared parameter type, you can declare MotorRowboat, SmallEngine or BaseMountable to react to only one path, or use BaseEntity to catch all of them. The player argument is the requesting player and can be null.

Because the return value is only consulted for non-null results, return true or any object to block the start. This is a cheap place to enforce fuel policies, permissions, group access or a cooldown before the engine actually spins up.

Other signatures

Oxide also calls OnEngineStart from other places in the game with these parameter types. Declare the overload you need, or several:

  • object OnEngineStart(MotorRowboat motorRowboat, BasePlayer driver)
  • object OnEngineStart(BaseMountable owner, BasePlayer player)

Example plugin: Require permission to start boat and vehicle engines

EngineStartPermission.cs
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;
using UnityEngine;

namespace Oxide.Plugins
{
    [Info("Engine Start Permission", "RustPluginGenerator", "1.0.0")]
    [Description("Requires a permission before a player can start a boat or vehicle engine.")]
    public class EngineStartPermission : RustPlugin
    {
        private const string PermUse = "enginestartpermission.use";

        private PluginConfig config;

        private class PluginConfig
        {
            [JsonProperty("Blocked start message")]
            public string BlockedMessage { get; set; } = "You are not allowed to start this engine.";
        }

        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>
            {
                ["NoPermission"] = "You are not allowed to start this engine."
            }, this);
        }

        private string Msg(string key, string userId = null) => lang.GetMessage(key, this, userId);

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

        // Catches SmallEngine.TurnOn, MotorRowboat.EngineToggle and VehicleEngineController.TryStartEngine.
        private object OnEngineStart(BaseEntity engineOwner, BasePlayer player)
        {
            if (engineOwner == null || engineOwner.IsDestroyed)
                return null;

            if (player == null || !player.IsConnected)
                return null;

            if (permission.UserHasPermission(player.UserIDString, PermUse))
                return null;

            player.ChatMessage(Msg("NoPermission", player.UserIDString));
            return true;
        }
    }
}

The plugin registers a single permission, enginestartpermission.use, and handles OnEngineStart with BaseEntity so it catches the small engine, motor rowboat and mountable paths in one method. When the requesting player is missing or lacks the permission, it sends a chat message and returns true, which halts the start before flags are set. Players with the permission get null back and the engine starts normally. The message text is stored in the language file rather than hard-coded, so it can be translated by editing oxide/lang.

Common use cases

  • Restrict engine starts by permission or group

    Gate boat and vehicle engines behind a permission, VIP group or team ownership check so only allowed players can spin them up.

  • Block starts when fuel is low or absent

    The SmallEngine.TurnOn call happens before the fuel check, so you can intercept it early and reply with a warning instead of a silent no-start.

  • Log or notify owners

    Message the boat's owner or a team channel when someone else tries to start an engine, or record the attempt with the player's ID and the entity's net ID.

Pitfalls

  • Returning true blocks vanilla fuel checks

    On the SmallEngine path, your hook runs before HasFuel() and the auth check. If you return non-null for every call, players will never learn whether the boat had fuel; they only see your block.

  • The first argument is not always a SmallEngine

    Declaring SmallEngine as the parameter type silences the hook on MotorRowboat and vehicle mountables because Oxide skips calls where the argument does not match. Use BaseEntity if you want all three paths.

  • Player may be null or unrelated

    On MotorRowboat.EngineToggle the player is the current driver, which can be null, and on other paths it may not be the boat's owner. Null-check it and use OwnerID if ownership matters.

Build a plugin with OnEngineStart

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

Prompt: Restrict engine starts by permission or group using the OnEngineStart 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 OnEngineStart

Generate