Skip to content
RustPluginGenerator

OnEngineStarted

OnEngineStarted is called after a vehicle engine successfully begins starting, from the vehicle engine controller and from the motor rowboat engine toggle.

Signature
void OnEngineStarted(BaseMountable owner, BasePlayer player)

Parameters

Hook parameters
ParameterTypeDescription
ownerBaseMountableThe mountable vehicle or mount point whose engine was just started. Usually a BaseVehicle, ModularCar, MiniCopter or similar BaseMountable; occasionally a MotorRowboat when the hook fires from the boat's own engine toggle.
playerBasePlayerThe BasePlayer who triggered the start (the driver/operator passed into the engine controller). May be null when the start was triggered by server code rather than a player.

Return value

The return value is ignored at both injection sites, so returning null or any value has no effect on the game. The hook is informational; use it to observe starts, not to block them.

How it works

This hook fires right after the game has accepted an engine start request. There are two injection points.

  • VehicleEngineController.TryStartEngine calls it after it sets the engine-starting flag, clears the running flag, schedules the finished-starting callback, and passes the controller's owner (a BaseMountable) plus the starting player.
  • MotorRowboat.EngineToggle calls it when wantsOn is true, after setting the On flag on the boat, passing the boat as owner and the driver as player.

Because both sites pass a BaseMountable, you can narrow the first parameter: declaring BaseMountable catches both, but declaring MotorRowboat only receives the boat call, and declaring a specific vehicle type (e.g. MiniCopter) only receives calls where the owner is that type. Oxide skips calls whose arguments are not instances of your declared parameter type.

The hook runs near the end of the start routine, so the vehicle is not yet fully running: startup finishes on a later scheduled callback (OnEngineStartFinished fires after that). Use it to react to a successful start request, not to rewrite engine state. player can be null if the start came from non-player code.

Other signatures

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

  • void OnEngineStarted(MotorRowboat motorRowboat, BasePlayer driver)

Example plugin: Announce boat engine starts to the crew

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

namespace Oxide.Plugins
{
    [Info("Rowboat Engine Announcer", "RustPluginGenerator", "1.0.0")]
    [Description("Announces motor rowboat engine starts to the driver and their team")]
    public class RowboatEngineAnnouncer : RustPlugin
    {
        private class PluginConfig
        {
            [JsonProperty("Announce to driver")]
            public bool AnnounceDriver { get; set; } = true;

            [JsonProperty("Announce to team")]
            public bool AnnounceTeam { get; set; } = true;
        }

        private PluginConfig config;

        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>
            {
                ["DriverStarted"] = "You started the engine of your rowboat.",
                ["TeamStarted"] = "{0} started the engine of a rowboat."
            }, this);
        }

        private string Msg(string key, string userId = null, params object[] args)
            => string.Format(lang.GetMessage(key, this, userId), args);

        private void OnEngineStarted(MotorRowboat boat, BasePlayer player)
        {
            if (boat == null || player == null || !player.IsConnected) return;

            if (config.AnnounceDriver)
            {
                player.ChatMessage(Msg("DriverStarted", player.UserIDString));
            }

            if (!config.AnnounceTeam || player.currentTeam == 0) return;

            var team = RelationshipManager.ServerInstance.FindTeam(player.currentTeam);
            if (team == null) return;

            foreach (var memberId in team.members)
            {
                if (memberId == player.userID.Get()) continue;
                var member = BasePlayer.FindByID(memberId);
                if (member == null || !member.IsConnected) continue;
                member.ChatMessage(Msg("TeamStarted", member.UserIDString, player.displayName));
            }
        }
    }
}

The plugin listens to OnEngineStarted and filters for MotorRowboat owners by declaring the parameter as MotorRowboat, so only the boat engine toggle path reaches the handler with a matching type. When a player is present and connected, it checks the config switch and sends a localized chat message to the driver plus a team-wide notice to that player's teammates via RelationshipManager.ServerInstance.FindTeam. Null guards cover a missing player, missing connection, and a player without a team. Messages come from the language file, and the enabled flag plus message text are exposed through config.

Common use cases

  • Crew alerts

    Notify a player's team when someone starts a vehicle engine, useful for large boat or heli crews coordinating out of voice range.

  • Operator logging

    Record who started which vehicle into your own data file for admin review of suspicious use of vehicles.

  • Custom effects

    Trigger a chat hint, sound effect or UI notice for the driver the moment a start is accepted, before the engine reaches full running state.

Pitfalls

  • Parameter typing skips calls

    Declaring a specific type like MotorRowboat or MiniCopter makes Oxide skip every call where the owner is a different type, so general-purpose handlers should declare BaseMountable.

  • Player can be null

    Both injection sites pass the player variable, which may be null when the start was triggered by server logic. Always null-check before using the player.

  • Not the same as fully running

    The engine is still in its startup phase when this fires. Use OnEngineStartFinished if you need to act once the vehicle is actually running.

Build a plugin with OnEngineStarted

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

Prompt: Crew alerts using the OnEngineStarted 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 OnEngineStarted

Generate