OnFlameThrowerBurn
OnFlameThrowerBurn is called for every fireball a FlameThrower creates during its flame tick, after the projectile entity has been spawned and before its NPC flag is applied.
void OnFlameThrowerBurn(FlameThrower flameThrower, BaseEntity entity)Parameters
| Parameter | Type | Description |
|---|---|---|
flameThrower | FlameThrower | The FlameThrower entity that is producing the fireball. Use it to read OwnerID, position and GetOwnerPlayer() to identify the wielder. |
entity | BaseEntity | The newly created FireBall entity, already spawned into the world by the game before the hook fires. Cast it to FireBall to touch its members, or kill it to suppress the burn. |
Return value
The return value is ignored; the original FlameTick code runs regardless of what you return. To stop a particular fireball from burning anything, you must act on the entity yourself (for example call Kill() on it) rather than relying on a return value.
How it works
This hook fires inside FlameThrower.FlameTick, once per fireball the weapon ejects while the trigger is held. The game creates the projectile entity from the configured fireball prefab, assigns ownerPlayer as its creatorEntity, then calls the hook before it checks whether the owner is an NPC and sets ignoreNPC on the resulting FireBall.
Because the entity already exists when the hook runs, entity is a live, spawned BaseEntity with a net.ID, not a blueprint. That makes it usable for immediate inspection: entity.transform.position, entity.OwnerID, or casting to FireBall. The flameThrower argument gives context about the source weapon, so you can read GetOwnerPlayer(), the weapon's world position, and OwnerID to attribute the burn.
Declaring entity as a more specific type such as FireBall narrows the hook: Oxide only invokes your method when the created entity actually is that type. With the stock flamethrower prefab this normally holds, but a custom prefab that produces something else would be skipped.
Note the hook fires per projectile, not per tick of flame, so a flamethrower in continuous use calls it many times per second. Keep the body lightweight — no chat output, no entity scans, no config writes.
Example plugin: Restrict flamethrower burns in a no-fire zone
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;
using UnityEngine;
namespace Oxide.Plugins
{
[Info("Flame Zone Guard", "RustPluginGenerator", "1.0.0")]
[Description("Blocks flamethrower fireballs inside a configurable protected zone")]
public class FlameZoneGuard : RustPlugin
{
private const string PermBypass = "flamezoneguard.bypass";
private class PluginConfig
{
[JsonProperty("Zone center (x y z)")]
public string Center = "0 0 0";
[JsonProperty("Zone radius (meters)")]
public float Radius = 25f;
[JsonProperty("Warn player when blocked")]
public bool WarnPlayer = true;
[JsonProperty("Seconds between warnings per player")]
public float WarnCooldown = 10f;
}
private PluginConfig config;
private readonly Dictionary<ulong, float> lastWarn = new Dictionary<ulong, float>();
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>
{
["Blocked"] = "Flamethrowers are disabled inside the protected zone."
}, this);
}
private string Msg(string key, string userId = null, params object[] args)
{
return string.Format(lang.GetMessage(key, this, userId), args);
}
private void Init()
{
permission.RegisterPermission(PermBypass, this);
}
private void OnFlameThrowerBurn(FlameThrower flameThrower, BaseEntity entity)
{
if (entity == null) return;
Vector3 center;
if (!TryParseCenter(out center)) return;
if (Vector3.Distance(entity.transform.position, center) > config.Radius) return;
entity.Kill();
if (!config.WarnPlayer) return;
BasePlayer player = flameThrower != null ? flameThrower.GetOwnerPlayer() : null;
if (player == null || !player.IsConnected) return;
if (permission.UserHasPermission(player.UserIDString, PermBypass)) return;
ulong id = player.userID.Get();
float now = UnityEngine.Time.realtimeSinceStartup;
float last;
if (lastWarn.TryGetValue(id, out last) && now - last < config.WarnCooldown) return;
lastWarn[id] = now;
player.ChatMessage(Msg("Blocked", player.UserIDString));
}
private bool TryParseCenter(out Vector3 center)
{
center = Vector3.zero;
string[] parts = (config.Center ?? string.Empty).Split(' ');
float x, y, z;
if (parts.Length < 3) return false;
if (!float.TryParse(parts[0], out x)) return false;
if (!float.TryParse(parts[1], out y)) return false;
if (!float.TryParse(parts[2], out z)) return false;
center = new Vector3(x, y, z);
return true;
}
private void Unload()
{
lastWarn.Clear();
}
}
}The plugin defines a spherical protected area around a configurable position and radius. Each time a flamethrower produces a fireball, OnFlameThrowerBurn checks the fireball's position against that zone; if it is inside, the entity is killed immediately, so the fireball never travels or applies fire damage there. Players who pull the trigger inside the zone also receive a throttled chat warning, tracked per userID in a dictionary so the message does not spam on every projectile. Config exposes the zone centre, radius, message toggle and a bypass permission flamezoneguard.bypass. A short cached message lookup keeps the per-projectile path cheap, and the throttle dictionary is cleared in Unload.
Common use cases
No-fire zones around spawn
Kill fireballs that spawn inside a protected region to keep flamethrowers from griefing safe areas without banning the weapon outright.
Flamethrower damage analytics
Attribute each fireball to the wielder via
flameThrower.GetOwnerPlayer()and count usage per player for stats or leaderboard plugins.Custom projectile behaviour
Cast the entity to
FireBalland adjust properties before it travels, or replace it with a different effect entity for themed events.
Pitfalls
Fires per projectile, very frequently
A held trigger produces many calls per second. Avoid chat messages, permission lookups against many players, or data writes in the hook body without throttling.
Entity is already spawned
The fireball exists in the world when you receive it. Killing it works, but do not expect to intercept creation before spawn; use
OnEntitySpawnedif you need that stage.ownerPlayer can be null in the surrounding code
The vanilla code dereferences ownerPlayer after the hook. Do not assume the wielder is a connected player; check
GetOwnerPlayer()before using it.
Build a plugin with OnFlameThrowerBurn
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 OnFlameThrowerBurn
Generate