Skip to content
RustPluginGenerator

CanHelicopterDropCrate

CanHelicopterDropCrate is called when the Chinook (CH47) AI asks whether it is allowed to drop its supply crate. Returning a bool overrides the default decision; returning null keeps the vanilla check.

Signature
object CanHelicopterDropCrate(CH47HelicopterAIController helicopter)

Parameters

Hook parameters
ParameterTypeDescription
helicopterCH47HelicopterAIControllerThe CH47HelicopterAIController calling CanDropCrate. Use it to identify the Chinook (net.ID, position) or to inspect/flag the controller while deciding whether the crate drop should proceed.

Return value

Returning a bool replaces the game's decision: false blocks the drop, true allows it regardless of remaining crates. Returning null (or any non-bool) falls through to the vanilla numCrates > 0 check.

How it works

The hook fires inside CH47HelicopterAIController.CanDropCrate, which the game calls when the Chinook decides to release one of its crate drops. Vanilla logic returns numCrates > 0, so a helicopter that still carries crates will drop unless something intercepts it.

The single parameter is the CH47 AI controller instance, giving you access to its prefab, net ID, position, and any custom fields you attach. The hook does not fire per frame; it fires when the drop decision is evaluated, so lightweight logic is fine.

Declaring the parameter as CH47HelicopterAIController matches the game exactly. If you want to react only to specific helicopters (for example ones near a monument), inspect helicopter.transform.position or helicopter.net.ID.Value rather than narrowing the type further, since there is no more specific controller type in play.

Returning true forces the drop even if the aircraft has no crates left; returning false blocks the drop entirely for that evaluation. Returning null lets the vanilla numCrates > 0 check run unchanged.

Example plugin: Block Chinook drops inside building-blocked zones

ChinookDropZoneBlock.cs
using System.Linq;
using System;
using Newtonsoft.Json;
using Oxide.Core;
using UnityEngine;

namespace Oxide.Plugins
{
    [Info("Chinook Drop Zone Block", "RustPluginGenerator", "1.0.0")]
    [Description("Blocks Chinook supply crate drops that would land inside a tool-cupboard protected area.")]
    public class ChinookDropZoneBlock : RustPlugin
    {
        private const float ScanRadius = 40f;

        private PluginConfig config;

        private class PluginConfig
        {
            [JsonProperty("Block drops inside building zones")]
            public bool BlockInBuildingZone { get; set; } = true;

            [JsonProperty("Extra radius beyond privilege")]
            public float ExtraRadius { get; set; } = 10f;
        }

        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);

        private object CanHelicopterDropCrate(CH47HelicopterAIController helicopter)
        {
            if (helicopter == null) return null;
            if (!config.BlockInBuildingZone) return null;

            var position = helicopter.transform.position;
            var radius = ScanRadius + Mathf.Max(0f, config.ExtraRadius);

            var privileges = UnityEngine.Object.FindObjectsOfType<BuildingPrivlidge>();
            if (privileges == null) return null;

            for (int i = 0; i < privileges.Length; i++)
            {
                var privilege = privileges[i];
                if (privilege == null || privilege.IsDestroyed) continue;
                if (Vector3.Distance(privilege.transform.position, position) > radius) continue;

                return false;
            }

            return null;
        }
    }
}

The plugin checks whether the Chinook currently sits inside a zone covered by a tool cupboard. When CanHelicopterDropCrate fires it reads config.BlockInBuildingZone and, if enabled, scans nearby BuildingPrivlidge entities within a configurable radius. If any are found, it returns false to block the drop and logs a warning. Otherwise it returns null so vanilla decide based on remaining crates. The radius and toggle are read from config on startup, giving admins a way to prevent crate drops over player bases without disabling Chinooks.

Common use cases

  • Deny drops over monuments

    Return false when the Chinook is within a configured radius of a monument or custom zone, forcing loot to reach open terrain instead of landing on a safe-zone roof.

  • Gate drops behind a phase timer

    Return false until a server-wide event flag flips, so Chinooks only release crates during scheduled drop windows.

  • Track remaining crate drops

    Count allow decisions per helicopter net ID and broadcast the countdown when a Chinook is close to running out of crates.

Pitfalls

  • Firing repeatedly

    CanDropCrate can be evaluated multiple times before a drop resolves. Make your logic idempotent and avoid spawning entities or sending chat inside this hook.

  • Returning true forces a drop

    Returning true overrides vanilla's numCrates > 0 check. If you only want to allow the default behavior, return null instead so an exhausted Chinook does not keep dropping.

  • Parameter is null on custom variants

    Custom AI or admin-spawned variants may hand in a controller without a prefab. Guard the parameter before reading transform or net members.

Build a plugin with CanHelicopterDropCrate

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

Prompt: Deny drops over monuments using the CanHelicopterDropCrate 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 CanHelicopterDropCrate

Generate