Skip to content
RustPluginGenerator

OnHelicopterDropCrate

OnHelicopterDropCrate is called right after the CH47 Chinook creates the locked crate entity but before that crate is marked as dropped and spawned into the world.

Signature
void OnHelicopterDropCrate(CH47HelicopterAIController helicopter)

Parameters

Hook parameters
ParameterTypeDescription
helicopterCH47HelicopterAIControllerThe CH47HelicopterAIController (Chinook) that is dropping the crate. Use it to read the helicopter's position, owner, or to broadcast a warning around it.

Return value

The return value is ignored. The crate is still marked as dropped and spawned regardless of what your hook returns, so use the hook for notifications or side effects only, not to veto the drop.

How it works

The hook fires inside CH47HelicopterAIController.DropCrate, which the Chinook runs once per crate it releases at a drop site. At that moment the crate entity already exists but has not been told it was dropped and has not been spawned yet, so it is not visible or lootable. The single parameter is the helicopter controller, not the crate, so you cannot intercept the crate entity directly through the hook argument.

The only parameter is useful for proximity checks: helicopter.transform.position gives the drop point, and helicopter.OwnerID or helicopter.net.ID.Value identify the event. Filtering by type is simple because the parameter is already the concrete CH47HelicopterAIController class; you can use the hook to react only to Chinooks rather than other event helicopters.

Because the hook runs before Spawn() and SetWasDropped, any code you run here executes in the same tick the crate appears. Keep the body short: players nearby still see the crate spawn normally. The hook does not let you cancel the drop; the return value is ignored.

Example plugin: Announce Chinook crate drops to nearby players

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

namespace Oxide.Plugins
{
    [Info("Chinook Crate Alert", "RustPluginGenerator", "1.0.0")]
    [Description("Chat-alerts players near a Chinook when it drops a locked crate.")]
    public class ChinookCrateAlert : RustPlugin
    {
        private const string PermTest = "chinookcratealert.test";
        private const string PermUse = "chinookcratealert.use";

        private PluginConfig config;
        private float lastAlertTime = -999f;

        private class PluginConfig
        {
            [JsonProperty("Alert radius (metres)")]
            public float Radius { get; set; } = 120f;

            [JsonProperty("Minimum seconds between alerts")]
            public float Cooldown { get; set; } = 60f;

            [JsonProperty("Alert admins too")]
            public bool IncludeAdmins { 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>
            {
                ["DropAlert"] = "A Chinook dropped a locked crate {0}m from you. Get moving!",
                ["NoDrops"] = "No Chinook crate drop is recorded right now.",
                ["TestSent"] = "Test drop alert sent to {0} player(s)."
            }, 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(PermTest, this);
            permission.RegisterPermission(PermUse, this);
        }

        private void Unload()
        {
            lastAlertTime = -999f;
        }

        private void OnHelicopterDropCrate(CH47HelicopterAIController helicopter)
        {
            if (helicopter == null || helicopter.IsDestroyed) return;
            AlertNearby(helicopter.transform.position, true);
        }

        private void AlertNearby(UnityEngine.Vector3 origin, bool respectCooldown)
        {
            float now = UnityEngine.Time.realtimeSinceStartup;
            if (respectCooldown && now - lastAlertTime < config.Cooldown) return;
            lastAlertTime = now;

            int sent = 0;
            foreach (BasePlayer player in BasePlayer.activePlayerList)
            {
                if (player == null || !player.IsConnected || player.IsDead()) continue;
                if (!config.IncludeAdmins && player.IsAdmin) continue;
                if (!permission.UserHasPermission(player.UserIDString, PermUse)) continue;

                float dist = UnityEngine.Vector3.Distance(player.transform.position, origin);
                if (dist > config.Radius) continue;

                player.ChatMessage(Msg("DropAlert", player.UserIDString, UnityEngine.Mathf.RoundToInt(dist)));
                sent++;
            }
            return;
        }

        [ChatCommand("chinooktest")]
        private void CmdTest(BasePlayer player, string command, string[] args)
        {
            if (player == null) return;
            if (!player.IsAdmin && !permission.UserHasPermission(player.UserIDString, PermTest))
            {
                player.ChatMessage(Msg("NoDrops", player.UserIDString));
                return;
            }
            AlertNearby(player.transform.position, false);
            player.ChatMessage(Msg("TestSent", player.UserIDString, 1));
        }
    }
}

The plugin listens for OnHelicopterDropCrate, which the Chinook calls for each crate it releases. On each call it reads the helicopter's world position and checks the configured radius for connected players that are close enough. Matching players get a chat message built from the language file with the distance rounded to whole metres, and admins can trigger a manual test broadcast with /chinooktest. A configurable minimum interval stops repeated drops at the same site from spamming chat. The helicopter handler never logs, and unload simply clears the cooldown so a reload starts clean.

Common use cases

  • Warn nearby players of a crate drop

    Send a chat message to players within a configured radius of the Chinook so they know a locked crate is landing next to them before they see it.

  • Trigger a server-wide event announcement

    Broadcast the drop location or grid reference to everyone when a Chinook releases its crate, optionally only for player-owned events rather than automatic ones.

  • Log crate drops for admin audits

    Append the drop position and time to an Oxide data file or write a single line during a low-frequency event so staff can review when and where Chinook crates appeared.

Pitfalls

  • The parameter is the helicopter, not the crate

    You cannot reach the crate entity from this hook argument. If you need the crate itself, use OnEntitySpawned and check the type or prefab name after the drop.

  • Cannot block the drop

    The return value is discarded, so returning null or any value does not stop the crate from spawning. Use CanHelicopterDropCrate if you need to influence whether the Chinook drops at all.

  • Timing relative to spawn

    The hook runs before SendMessage("SetWasDropped") and Spawn(), so the crate is not yet visible or lootable. Do not try to read or modify the crate's contents here.

Build a plugin with OnHelicopterDropCrate

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

Prompt: Warn nearby players of a crate drop using the OnHelicopterDropCrate 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 OnHelicopterDropCrate

Generate