Browse docs
Server: GetOilSpills()
Call these exports from a server script in your own resource, with sky_firejob started. They create or remove an incident when called. Automatic oil leaks after collisions or from wear need Sky Mechanic or another resource that detects the condition and calls Firejob.
The return formats and IDs differ between fire and oil exports:
| Operation | Return value on success | ID to keep |
|---|---|---|
CreateFire | One table: { success = true, fireId = ..., type = ..., label = ... } | result.fireId, a numeric fire ID |
CreateVehicleFire | One table: { success = true, fireId = ... } | Keep the vehicle network ID you supplied for RemoveVehicleFire; result.fireId identifies the fire |
CreateOilSpill | Two values: true, spill | spill.id, a string such as "17", for RemoveOilSpill |
GetOilSpills | An array of spill tables | Each entry's spill.id; the array index is not the spill ID |
creator, where accepted, is a player's current server ID (source). Use 0 or omit it for server-created incidents. It is separate from the vehicle network ID, fire ID, and oil spill ID.
Server Exports
GetOilSpills()
Takes no arguments and returns an array of all currently active server-side spills, including both fresh and bound spills. Each entry has the same fields documented under CreateOilSpill. When there are no active spills, the result is an empty table {}.
-- server.lua
local spills = exports["sky_firejob"]:GetOilSpills()
for _, spill in ipairs(spills) do
print(("Spill %s: state=%s, source=%s, position=%.2f, %.2f, %.2f"):format(
spill.id,
spill.state,
spill.source,
spill.coords.x,
spill.coords.y,
spill.coords.z
))
end
Use spill.id as the removal ID. The position of an entry in this array can change as spills are added or removed. Re-query when you need current state; editing a returned table is not a supported update API.