createFire
Creates a managed fire element when given an options table, or the original native GTA fire otherwise.
Syntax
fire|bool createFire(float x, float y, float z [, table options])Arguments
xfloatWorld X.
yfloatWorld Y.
zfloatWorld Z.
optionstableoptionalOptional table of duration, strength, damage, damageTargets, spread, maxGenerations, source and target. Passing it is what makes the fire managed.
Table keys
durationintoptional · default 5000Total lifetime in milliseconds.
strengthfloatoptional · default 1.0Size multiplier. Around 1, 2 and 3 select GTA's small, medium and large fire effects.
damagebooloptional · default trueWhether the fire damages anything at all.
damageTargetstableoptionalMask of players, peds, vehicles and objects booleans. Omitted keys default to true.
spreadbooloptional · default falseWhether the fire can spawn further fires.
maxGenerationsintoptional · default 0Generation limit for spreading, 0 through 255.
sourceelementoptionalElement blamed for the damage, reported as responsibleElement in onClientFireDamage.
targetelementoptionalElement the fire follows. The fire rides it wherever it goes.
Returns
A fire element for the managed form; a boolean for the legacy native form; false on failure.
Ownership and lifecycle
A managed fire is an element owned by the resource that created it, so stopping that resource extinguishes its fires. Server-created fires are synchronized to every client, and lifetime is tracked as relative remaining time so a client joining mid-burn receives what is left.
- Passing a table as the fourth argument is the switch: it returns a real element with a persistent identity that can be changed while it burns.
- On the client, a number or omitted fourth argument keeps the original native GTA fire and still returns a boolean, so existing resources are unaffected.
- On the server, a number fourth argument is read as strength and still creates a managed fire.
- Defaults are duration 5000 ms, strength 1.0, damage on, spread off, maxGenerations 0, and all four damage targets enabled.
- Server-created fires are synchronized to every client, and a player joining mid-burn receives the remaining lifetime rather than a restarted one.
Example
local fire = createFire(x, y, z, { duration = 10000, strength = 1.5, damageTargets = { players = false, peds = true, vehicles = true, objects = true },})