# Server: CreateVehicleFire(payload, creator, options)

> Reference for Server: CreateVehicleFire(payload, creator, options) in firejob.

[All exports](/docs/jobs/firejob/reference/exports)

**Optional developer integration.** Call this export from a **server script** in your own resource after `sky_firejob` has started. For normal installation and gameplay, use [Installation](/docs/jobs/firejob/setup/installation).

## Server Exports

### `CreateVehicleFire(payload, creator, options)`

Creates a fire associated with a vehicle, using Firejob's configured fire progression, vehicle state, and explosion behavior.

<table>
<thead>
  <tr>
    <th>
      Argument / payload field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required / default
    </th>
    
    <th>
      Meaning
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        payload
      </code>
    </td>
    
    <td>
      <code>
        table
      </code>
    </td>
    
    <td>
      Required
    </td>
    
    <td>
      Vehicle fire creation data
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        payload.netId
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Supply for an attached vehicle fire
    </td>
    
    <td>
      Network ID of the existing vehicle, obtained by your vehicle integration; not an entity handle or plate
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        payload.coords
      </code>
    </td>
    
    <td>
      <code>
        { x, y, z }
      </code>
      
       or <code>
        vector3
      </code>
    </td>
    
    <td>
      Optional when <code>
        netId
      </code>
      
       resolves to an existing vehicle
    </td>
    
    <td>
      Fire position; otherwise the vehicle position is used
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        payload.plate
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Optional
    </td>
    
    <td>
      Vehicle plate metadata; does not find or select a vehicle
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        payload.source
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Optional
    </td>
    
    <td>
      Description of the origin, such as your resource name
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        payload.initialStage
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        "smoke"
      </code>
    </td>
    
    <td>
      <code>
        "smoke"
      </code>
      
      , <code>
        "smallFire"
      </code>
      
      , or <code>
        "fullFire"
      </code>
      
      , when progression is enabled
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        payload.smokeDensity
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Config/profile default
    </td>
    
    <td>
      Smoke density; the selected progression stage can override it
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        payload.explosionDelaySeconds
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Config default
    </td>
    
    <td>
      Explosion delay in seconds when explosions are enabled; progression can delay the start of this timer
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        payload.engineHealth
      </code>
      
      , <code>
        bodyHealth
      </code>
      
      , <code>
        petrolTankHealth
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Config defaults
    </td>
    
    <td>
      Optional vehicle health overrides
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        payload.effects
      </code>
    </td>
    
    <td>
      <code>
        table
      </code>
    </td>
    
    <td>
      Profile defaults
    </td>
    
    <td>
      Optional <code>
        flame
      </code>
      
       and <code>
        smoke
      </code>
      
       catalog IDs; unknown IDs return <code>
        invalid_effect
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        creator
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <code>
        0
      </code>
    </td>
    
    <td>
      Player server ID, or <code>
        0
      </code>
      
       for a server-created incident
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options
      </code>
    </td>
    
    <td>
      <code>
        table
      </code>
    </td>
    
    <td>
      Optional
    </td>
    
    <td>
      Creation context, described below
    </td>
  </tr>
</tbody>
</table>

For a normal integration, omit `options` or pass `{ reason = "my_resource" }`. The reason is recorded as the fire's origin. When `creator > 0`, normal external creation checks the external-fire enable setting and player distance.

The optional context flags change behavior: `manual = true` applies manual ignition checks; `accident = true` uses accident scaling and context; `scenario = true` uses scenario context and permits `payload.sourceScale`, `progressionEnabled`, and `explosionEnabled` overrides. These are trusted server-side integration options, not permissions to forward from client input.

The export returns **one table**:

- Success: `{ success = true, fireId = <number> }`.
- Failure: `{ success = false, error = <string> }`. Errors include `disabled`, `invalid_coords`, `already_burning`, `limit`, `external_disabled`, `too_far`, `invalid_effect`, and `create_failed`.
- `already_burning` can include the existing `fireId` when the vehicle is already registered. A nearby-fire rejection need not include an ID.
- Manual ignition can additionally return `not_on_duty`, `required_jobs`, `missing_item`, `invalid_player`, or `cooldown`; a cooldown response includes `remaining` seconds.

```lua
-- server.lua; replace 123 with the existing vehicle's real network ID.
local vehicle_net_id = 123
local result = exports["sky_firejob"]:CreateVehicleFire({
    netId = vehicle_net_id,
    source = "my_incident_resource",
    initialStage = "smoke"
}, 0)

if not result.success then
    print(("Could not create vehicle fire: %s"):format(result.error))
    return
end

print(("Created fire %s on vehicle %s"):format(result.fireId, vehicle_net_id))
-- Keep vehicle_net_id in your incident state for RemoveVehicleFire.
```

Creation accepts coordinates without a resolvable vehicle, but such a fire is not necessarily tied to an existing vehicle. Supply a valid vehicle network ID when you need vehicle attachment and later removal with `RemoveVehicleFire`.
