CanUseHelicopter
CanUseHelicopter is called when a player attempts to mount a CH47 Chinook helicopter, before the game performs its own mount checks and seating logic. Returning a non-null value cancels the mount.
object CanUseHelicopter(BasePlayer player, CH47HelicopterAIController cH47HelicopterAIController)Parameters
| Parameter | Type | Description |
|---|---|---|
player | BasePlayer | The BasePlayer who is trying to mount the CH47 Chinook. Null-check it, since the hook can be reached through AI or scripted mount attempts. |
cH47HelicopterAIController | CH47HelicopterAIController | The CH47HelicopterAIController being mounted. This is the AI controller entity for the Chinook, not the BaseHelicopter itself; use it for position checks or to read the entity's net ID. |
Return value
Return null to let the vanilla AttemptMount run and mount the player normally. Return any non-null value (for example false) to stop the call, so the player is never seated on the Chinook and no mount checks or seat assignment happen.
How it works
The hook fires from CH47HelicopterAIController.AttemptMount, which the game calls when something tries to seat a BasePlayer on the Chinook. That covers normal use-key interaction on the helicopter as well as scripted or AI-driven mount attempts; the doMountChecks flag passed to the original method is not exposed to the hook. Because the injection is at the top of the override, your code runs before the vanilla checks for distance, seating, and occupancy.
player is the candidate occupant and cH47HelicopterAIController is the AI controller of the Chinook entity. Use the player for permission, team, or status checks, and the controller for location or ownership context. Declaring player as a more specific type such as BasePlayer is already the most specific type the game passes here, so type narrowing does not filter anything on this hook; check player == null instead.
This only covers the AI-controlled Chinook (CH47HelicopterAIController). Player-purchased or event-spawned transport helicopters follow different mount paths, so this hook is not a general helicopter lock.
Example plugin: Restrict Chinook mount to a permission
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;
using UnityEngine;
namespace Oxide.Plugins
{
[Info("Chinook Mount Permission", "RustPluginGenerator", "1.0.0")]
[Description("Restricts mounting the AI CH47 Chinook to players holding a permission.")]
public class ChinookMountPermission : RustPlugin
{
private const string PermUse = "chinookmountpermission.use";
private PluginConfig config;
private class PluginConfig
{
[JsonProperty("Require permission to mount the Chinook")]
public bool RequirePermission { get; set; } = true;
[JsonProperty("Notify player when denied")]
public bool NotifyDenied { 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>
{
["Denied"] = "You do not have permission to board this Chinook.",
["NoPermission"] = "You are missing the permission '{0}'."
}, 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(PermUse, this);
}
private object CanUseHelicopter(BasePlayer player, CH47HelicopterAIController chinook)
{
if (player == null || chinook == null || !config.RequirePermission)
return null;
if (permission.UserHasPermission(player.UserIDString, PermUse))
return null;
if (config.NotifyDenied && player.IsConnected)
player.ChatMessage(Msg("Denied", player.UserIDString));
return false;
}
}
}The plugin registers a single permission, chinookmountpermission.use, and checks it in CanUseHelicopter. When a player without the permission tries to mount the AI Chinook, the hook returns false, which prevents AttemptMount from running, and the player receives a chat message from the language file. Players holding the permission get a null return, so the normal mount path proceeds untouched. The permission prefix matches the lowercase class name, LoadDefaultMessages provides both a denial and an admin message, and Unload needs no cleanup because nothing is stored or displayed. Set the permission to false for the default group and grant it to admins or a donor group to gate the Chinook.
Common use cases
Permission-gated helicopter access
Allow only members of a donor, event, or admin group to board the AI Chinook by checking
permission.UserHasPermissionand returningfalsefor everyone else.Block mounting while wounded or banned
Inspect
player.IsWounded(), health, or an event flag and cancel the mount when the player should not be flying, keeping the Chinook available for eligible players.Event-only Chinook access
Track an active event state in the plugin and only permit mounts while the event is running, returning
falsewhen the Chinook should be off-limits.
Pitfalls
Returning true still cancels the mount
The injection treats any non-null return as a block. Returning
truedoes not mean 'allow'; returnnullto allow and a non-null value such asfalseto deny.Only the AI Chinook is covered
This hook fires from
CH47HelicopterAIController, so it does not control mounting onMiniCopter,BaseBoat, or other vehicles. Those need their own vehicle hooks or mount handling.Messages can repeat
A player holding the use key can trigger multiple mount attempts, so a denial message may appear repeatedly. If that is noisy, send only the denial text, keep it short, or rate-limit it per player.
Build a plugin with CanUseHelicopter
Describe what should happen and get a compiled plugin that uses this hook.
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 CanUseHelicopter
Generate