# Treatment

> Reference for Treatment in ambulancejob.

[All client exports](/docs/jobs/ambulancejob/api/client-exports)

## Treatment

### `OpenTreatment(serverId?)`

Starts the normal diagnosis and treatment workflow from your own client-side radial or interaction menu. Available to eligible medics and authorized Public Treatment responders.

```lua
-- Treat the nearest eligible patient within the configured interaction distance.
local started, reason = exports["sky_ambulancejob"]:OpenTreatment()
```

```lua
-- Treat a specific patient using their server ID.
local started, reason = exports["sky_ambulancejob"]:OpenTreatment(serverId)
```

<table>
<thead>
  <tr>
    <th>
      Argument
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        serverId
      </code>
    </td>
    
    <td>
      <code>
        number?
      </code>
    </td>
    
    <td>
      Optional patient server ID. Omit it to select the nearest eligible patient. Pass a server ID, not a local player index or ped handle.
    </td>
  </tr>
</tbody>
</table>

The targeted player must be nearby and streamed on the calling client. For your own injuries, use [`OpenSelfDiagnose()`](#self-diagnose).

<table>
<thead>
  <tr>
    <th>
      Return value
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        started
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Whether the workflow was accepted. Preparation, cancellation or subsequent server validation can still prevent the diagnosis UI from opening.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        reason
      </code>
    </td>
    
    <td>
      <code>
        string | table | nil
      </code>
    </td>
    
    <td>
      Immediate rejection reason when <code>
        started
      </code>
      
       is <code>
        false
      </code>
      
      . Examples include <code>
        no_patient
      </code>
      
      , <code>
        busy
      </code>
      
      , <code>
        missing_gear
      </code>
      
      , <code>
        not_authorized
      </code>
      
      , <code>
        public_conscious_blocked
      </code>
      
       and <code>
        too_far
      </code>
      
      . A revival block returns a table with <code>
        reason = "revive_blocked"
      </code>
      
       and patient/revival context.
    </td>
  </tr>
</tbody>
</table>

Call the export from a client event/menu callback or a `CreateThread`, because it waits for server callbacks. Add `dependency "sky_ambulancejob"` to your resource's `fxmanifest.lua`. Close your radial menu before calling the export so that the menu's focus cleanup does not interfere with diagnosis.

The export keeps the normal server-side access, required-item, patient-state and distance checks. For non-medics, enable Public Treatment and configure its conscious-patient policy. Disabling **Keyboard interaction enabled** hides the public E prompt and disables its key while both export forms remain available. See [Public Treatment and radial menus](/docs/jobs/ambulancejob/setup/configuration#public-treatment-and-radial-menus) for the settings.

<br />
