OnRocketLaunched
OnRocketLaunched is called on the server right after a rocket fired from a rocket launcher has been spawned as a projectile entity.
void OnRocketLaunched(BasePlayer player, BaseEntity entity)Parameters
| Parameter | Type | Description |
|---|---|---|
player | BasePlayer | The BasePlayer who fired the launcher. Can be null when a launcher is fired by a non-player source, so guard before reading player data. |
entity | BaseEntity | The spawned rocket BaseEntity (a TimedExplosive projectile). It has already been spawned at the time the hook runs, so it is a valid server entity you can track, move or kill. |
Return value
The hook is attached to a void method and its result is discarded, so returning null or any value changes nothing about the launcher's behavior. To affect the shot you must act on entity (for example entity.Kill()).
How it works
The hook fires inside BaseLauncher.SV_Launch, immediately after the projectile has been spawned and its velocity initialized. By the time Oxide calls it, the rocket already exists as a BaseEntity in BaseNetworkable.serverEntities and the launcher has not yet started its attack cooldown or consumed the owner's ammo, so anything you do to the entity here takes effect before the launcher finishes the shot.
The player argument is the shooter and is the natural place to run permission checks, statistics or per-player cooldowns. The entity argument is the rocket itself: you can log its prefab, attach it to a tracking list, or call Kill() on it to cancel the shot. Because the projectile is already spawned, killing it removes the rocket without refunding ammo, and the cooldown and ammo consumption code still runs afterwards.
You cannot narrow this hook by declaring a more specific parameter type in a useful way: the launcher always passes a BasePlayer and the rocket entity type is internal to the launcher code. Return type is void, so whatever you return is ignored.
This fires for every launcher that goes through SV_Launch, including rocket launchers and similar explosive launchers that share this base class. It does not fire for thrown explosives such as C4 or grenades.
Example plugin: Block rockets from players without a permission
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;
using UnityEngine;
namespace Oxide.Plugins
{
[Info("RocketPermissionGate", "RustPluginGenerator", "1.0.0")]
[Description("Blocks rockets fired by players who lack a permission.")]
public class RocketPermissionGate : RustPlugin
{
private const string PermUse = "rocketpermissiongate.use";
private PluginConfig config;
public class PluginConfig
{
[JsonProperty("Blocked message color")]
public string BlockedColor { get; set; } = "#ce422b";
}
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>
{
["NoPermission"] = "<color={0}>You are not allowed to fire rockets.</color>"
}, 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 void OnRocketLaunched(BasePlayer player, BaseEntity entity)
{
if (player == null || entity == null) return;
if (player.IsAdmin) return;
if (permission.UserHasPermission(player.UserIDString, PermUse)) return;
entity.Kill();
player.ChatMessage(Msg("NoPermission", player.UserIDString, config.BlockedColor));
}
}
}RocketPermissionGate registers a single permission, rocketpermissiongate.use, in Init. When OnRocketLaunched fires it null-checks the player and entity, then checks permission.UserHasPermission. Players without the permission get the freshly spawned rocket killed via entity.Kill() and a localized chat message. Admins are exempt so testers are not locked out. The ammo and attack cooldown still complete, which mirrors how a server admin would expect a blocked shot to behave rather than silently refunding rockets. All player-facing text goes through lang, so the message can be translated without touching code.
Common use cases
Track rocket usage per team
Increment a counter in a data file each time
OnRocketLaunchedfires and key it byplayer.currentTeamto report which groups are burning the most explosives during a raid meta.VIP-only launchers
Check a permission on the shooter and call
entity.Kill()when it is missing, turning rockets into a donator perk without modifying weapon prefabs.Raid alerts
Broadcast the shooter's name and grid position to online players with the
vippermission so defenders know a rocket was fired at their base.
Pitfalls
The rocket is already spawned
You cannot stop the entity from being created here. To cancel the shot you must call
Kill()on the passed entity; simply returning from the hook leaves the rocket flying.Ammo is still consumed
The hook runs before the owner item and ammo logic in
SV_Launch, so killing the rocket does not prevent the launcher from using a rocket and starting its cooldown.player can be null
Launchers can be fired by non-player entities or scripted setups; always null-check
playerbefore readingUserIDStringor callingChatMessage.
Build a plugin with OnRocketLaunched
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 OnRocketLaunched
Generate