Browse docs
Lua exports
Use the server exports to control fireworks from a DJ script, event schedule or other FiveM resource. Add the dependency to the calling resource so Fireworks starts first. FiveM Lua exports
dependency "sky_fireworks"
Server exports
| Export | Success | Behaviour |
|---|---|---|
GetFireworkCatalog() | Array of entries | Each entry has preset, item, kind, label and shots. Use a returned preset or item ID when spawning. |
SpawnFirework(preset, coords, options?) | Article ID | Places an unlit article. Pass a vector3 or { x, y, z } at the base of the model. Optional heading is in degrees and bucket defaults to 0. |
GetFirework(id) | Article table | Returns id, preset, coords, heading, bucket and status. After ignition it includes runId and startsInMs. |
IgniteFirework(id, options?) | Run ID | Schedules one article. Optional delayMs sets its first cue offset and fuse = true plays the in-game fuse where supported. |
IgniteFireworks(cues, options?) | Run ID | Takes an array of { id, delayMs? } entries for the same routing bucket. Equal delays start together. Optional fuse = true applies to the whole sequence. |
GetFireworkShow(runId) | Run table | Returns id, ids, bucket, status, startsInMs and endsInMs. |
DeleteFirework(id) | true | Removes an unlit article or stops a run with a single article. |
StopFireworkShow(runId) | true | Cancels a scheduled run or stops an active one, including every article in that run. |
Article status is placed, scheduled or running. Run status is scheduled until the first cue and running until playback ends. Both IDs are strings and expire at the end of playback, on removal or when their owning resource stops. Each resource can access and control its own IDs. API placements stream to nearby players in the selected routing bucket without changing player inventories.
Delays are whole milliseconds and default to 0. The sequence can last up to 30 minutes within the playback budget. Fireworks adds a short synchronization lead. Fuses and large sequences can add more lead time. Read startsInMs from the run right after ignition to line up music or lighting with its first cue. Roman candles and Bengal flares from the catalogue play as stationary effects.
Start a timed sequence
Call this from your server-side cue handler. Supply the actual base coordinates of each article and the event's routing bucket. The two fountains start together, followed by the battery 2.5 seconds later.
local fireworks = exports["sky_fireworks"]
local function fireDisplay(left, right, center, bucket)
local placements = {
{ preset = "goldfountain", coords = left, delayMs = 0 },
{ preset = "silverfan", coords = right, delayMs = 0 },
{ preset = "sky_firework_signalnine", coords = center, delayMs = 2500 },
}
local cues = {}
local function clearPlacements()
for _, cue in ipairs(cues) do
fireworks:DeleteFirework(cue.id)
end
end
for _, placement in ipairs(placements) do
local id, reason = fireworks:SpawnFirework(placement.preset, placement.coords, { bucket = bucket })
if not id then
clearPlacements()
return false, reason
end
cues[#cues + 1] = { id = id, delayMs = placement.delayMs }
end
local runId, reason = fireworks:IgniteFireworks(cues)
if not runId then clearPlacements() end
return runId, reason
end
Handle a rejected call
An unsuccessful call returns false, reason. A rejected ignition leaves the placed articles available for retry or removal.
| Error | Meaning |
|---|---|
invalid_caller, not_found | The call has no owning server resource, or the ID is unknown, expired or belongs to another resource. |
invalid_preset, invalid_coords, invalid_options | Use a preset from the catalogue, valid world coordinates and supported option types. |
invalid_cues, invalid_delay, duplicate_id | Supply a dense array with one entry per article and a whole delay in milliseconds. |
already_ignited, part_of_show | The article already belongs to a run. Use StopFireworkShow to cancel a run containing several articles. |
different_bucket, different_area | A sequence needs one routing bucket and one site. Every article must be within 1,000 metres of its first listed article. |
limit, busy | The placement cap or the shared playback budget was reached. Try a smaller sequence, stagger its launches or wait for current runs to finish. |
particleStats()
exports["sky_fireworks"]:particleStats() takes no arguments and returns a table of numeric statistics for the local player's Fireworks renderer. Read it on demand during a show to compare distance, effect density and quality.
local stats = exports["sky_fireworks"]:particleStats()
print(("Fireworks native handles: %d (peak %d), failed starts: %d"):format(
stats.active, stats.native_peak, stats.native_start_failures
))
| Fields | Meaning |
|---|---|
active, active_primary, native_peak | Active native handles, active primary handles and the peak active handle count. |
visible_batteries, native_batteries | Nearby active sources considered by the native budget, including the sources currently allocated native detail. |
native_start_failures, native_backoff, native_configured_budget_limited, battery_limited | Failed native starts and skips due to backoff or budget. |
native_configured_budget, native_quality, sampled_frame_ms | Configured native budget, current local quality multiplier and smoothed client frame time in milliseconds. |
started, removed, expired, culled, late, fallback | Native stage starts, removal and expiry, visibility or timing skips, and alternative rendering. |
rise_started, rise_limited, launch_limited, burst_limited, ground_limited, fuse_limited | Stage-specific counters for rise, launch, burst, ground and fuse effects. |
visual_prepares, visual_limited_jobs, visual_skipped_jobs, visual_frustum_culled, visual_peak_triangles, smoke_light_samples | World-space render work, limits, view culling, peak triangle count and lighting samples. |
show_cleanup_batches, largest_show_cleanup | Cleanup count and the largest cleanup batch. |
timed_crackle_clouds, timed_crackle_onsets, timed_crackle_nests, timed_crackle_max_rise, timed_crackle_max_drop, timed_crackle_max_drift, timed_crackle_peak_triangles | Measurements for timed world-space crackle effects. |
relit_bouquets, brocade_segments, filtered_brocade_grains, willow_dust_prepared, willow_dust_drawn | Additional counters for authored spark, trail and dust effects. |
crackle_active, crackle_started, crackle_limited, crackle_peak | Legacy native crackle counters. The current renderer returns zero for these fields. |
Some counters reset when the renderer starts a new playback session after its owned stages clear. Read the export during comparable shots. Its counters describe Fireworks only. Use the performance guide for shared pool and audio checks.
Record the local mix
The Fireworks audio page provides a JavaScript diagnostic helper for listening checks. Select the sky_fireworks frame in FiveM NUI Developer Tools to use this example. FiveM NUI Developer Tools
const take = await recordFireworksMix(12);
console.log(take.sampleRate, take.startFrame, take.paddedFrames, take.gaps);
The duration is in seconds and must be greater than 0 and at most 90. The Promise returns the local stereo WAV in take.wav together with the sample rate, starting frame and gap information. You can pass an optional AbortSignal as the second argument. This is a local NUI helper.