Skip to content
RustPluginGenerator

CanHelicopterUseNapalm

CanHelicopterUseNapalm is called when a Patrol Helicopter checks whether its napalm cooldown has elapsed and it may start a new napalm pass.

Signature
object CanHelicopterUseNapalm(PatrolHelicopterAI patrolHelicopterAI)

Parameters

Hook parameters
ParameterTypeDescription
patrolHelicopterAIPatrolHelicopterAIThe PatrolHelicopterAI instance asking whether it may fire napalm. Use it to read the helicopter's position, health and target when deciding to allow or block the napalm strike.

Return value

Return true to allow napalm regardless of the cooldown, or false to block it. Returning null (or anything that is not a bool) leaves the vanilla time-based cooldown check in charge.

How it works

Runs inside PatrolHelicopterAI.CanUseNapalm, which the AI calls before committing to a napalm run on its current target. The vanilla check is purely time based: the call succeeds when Time.realtimeSinceStartup - lastNapalmTime is at least a random 25-35 second window. The hook fires before that check, so it is your chance to override the result.

The only argument is the helicopter AI instance. From it you can reach transform.position, the current target through the AI's target fields, and the helicopter entity itself. There is no player parameter, so any player-specific decision has to be derived from the helicopter's target or from external tracking you keep in your plugin.

Declaring the parameter as PatrolHelicopterAI is required; a more general type such as BaseEntity will not narrow anything here and would only break compilation if the members you use live on the AI class. Because the hook fires on every napalm eligibility check per helicopter, keep the body cheap: no Puts, no PrintWarning, no LINQ over all entities.

Practical use is controlling napalm on custom events, safe zones or per-map settings, for example disabling napalm entirely on a PvE server or allowing it only for helicopters with a specific skin.

Example plugin: Disable napalm on PvE servers with a config toggle

HelicopterNapalmControl.cs
using System.Collections.Generic;
using System;
using Newtonsoft.Json;
using Oxide.Core;

namespace Oxide.Plugins
{
    [Info("Helicopter Napalm Control", "RustPluginGenerator", "1.0.0")]
    [Description("Allows or blocks patrol helicopter napalm through a configuration flag")]
    public class HelicopterNapalmControl : RustPlugin
    {
        private const string PermToggle = "helicopternapalmcontrol.toggle";

        private PluginConfig config;

        private class PluginConfig
        {
            [JsonProperty("Allow napalm")]
            public bool AllowNapalm { get; set; } = false;
        }

        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>
            {
                ["NapalmOn"] = "Patrol helicopter napalm is now allowed.",
                ["NapalmOff"] = "Patrol helicopter napalm is now blocked.",
                ["NoPermission"] = "You do not have permission to change napalm settings."
            }, this);
        }

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

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

        [ChatCommand("helinapalm.toggle")]
        private void CmdToggle(BasePlayer player, string command, string[] args)
        {
            if (player == null) return;
            if (!permission.UserHasPermission(player.UserIDString, PermToggle))
            {
                SendReply(player, Msg("NoPermission", player.UserIDString));
                return;
            }

            config.AllowNapalm = !config.AllowNapalm;
            SaveConfig();
            SendReply(player, Msg(config.AllowNapalm ? "NapalmOn" : "NapalmOff", player.UserIDString));
        }

        private object CanHelicopterUseNapalm(PatrolHelicopterAI patrolHelicopterAI)
        {
            if (patrolHelicopterAI == null) return null;
            return config.AllowNapalm;
        }
    }
}

The plugin exposes one config flag, AllowNapalm. LoadDefaultConfig creates it, and CanHelicopterUseNapalm returns the flag value so every napalm eligibility check is decided by configuration instead of the built-in cooldown. With the flag off, the helicopter never starts a napalm pass; with it on, the vanilla cooldown logic is bypassed and napalm is always permitted when the AI asks. Admins flip the setting through the helinapalm.toggle chat command, which requires the helicopternapalmcontrol.toggle permission, and the message text lives in the language file.

Common use cases

  • Block napalm on PvE servers

    Return false unconditionally so patrol helicopters still shoot but never burn player bases with napalm.

  • Allow napalm during custom events only

    Keep a boolean set by an event plugin and return it here, so napalm only appears while an event helicopter is active.

  • Extend or shorten the napalm cooldown

    Return true when enough of your own timer has elapsed or false to force the helicopter to wait, giving you full control over strike frequency.

Pitfalls

  • Returning true overrides the cooldown entirely

    A true result skips the vanilla 25-35 second check, so a helicopter can start napalm passes back to back if the AI reaches this call again immediately. Gate it with your own timer.

  • The hook is checked often

    The AI asks repeatedly during a hunt. Keep the method cheap and never log inside it, or your server console will flood during helicopter fights.

  • No player parameter

    You cannot tell who the helicopter is targeting from the signature alone. Resolve the target from cached plugin data or skip player-specific rules here.

Build a plugin with CanHelicopterUseNapalm

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

Prompt: Block napalm on PvE servers using the CanHelicopterUseNapalm 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 CanHelicopterUseNapalm

Generate