Browse docs

Server: RemoveOilSpill(spillId, reason)

Reference for Server: RemoveOilSpill(spillId, reason) in firejob.

All exports

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:

OperationReturn value on successID to keep
CreateFireOne table: { success = true, fireId = ..., type = ..., label = ... }result.fireId, a numeric fire ID
CreateVehicleFireOne table: { success = true, fireId = ... }Keep the vehicle network ID you supplied for RemoveVehicleFire; result.fireId identifies the fire
CreateOilSpillTwo values: true, spillspill.id, a string such as "17", for RemoveOilSpill
GetOilSpillsAn array of spill tablesEach 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

RemoveOilSpill(spillId, reason)

Immediately removes an active spill and synchronizes the removal. Get spillId from the second return value of CreateOilSpill (spill.id), or from an entry returned by GetOilSpills().

ArgumentTypeRequired / defaultMeaning
spillIdstring or numberRequiredThe spill's id, such as "17"; not a vehicle ID, plate, or array index
reasonstring"export_removed"Removal reason, for example "incident_finished" or "scene_reset"

Returns one boolean: true when an active spill was removed, or false if no spill exists for that ID or an ID reset is in progress. There is no second error string. Removing the same spill twice normally returns true and then false.

The complete creation example above shows where the ID comes from. If your resource needs to find its active spills again, use their origin tag:

-- server.lua; matches the source tag used in the creation example.
for _, spill in ipairs(exports["sky_firejob"]:GetOilSpills()) do
    if spill.source == "my_incident_resource" then
        local removed = exports["sky_firejob"]:RemoveOilSpill(spill.id, "scene_reset")
        print(("Remove oil spill %s: %s"):format(spill.id, tostring(removed)))
    end
end

This example removes all active spills with that tag. Use the individual saved ID to remove only one. Direct export removal does not perform the absorbent/broom interaction or consume cleanup items. Reserve "cleaned" for normal cleanup completion: that reason can trigger configured rewards and scenario completion.