> For the complete documentation index, see [llms.txt](https://docs.otherplanet.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.otherplanet.dev/scripts/op-ambulance-mdt/integrations/p_ambulancejob.md).

# p\_ambulancejob

{% stepper %}
{% step %}

### Find Directory

Go to p\_ambulancejob/shared/config.lua

Find alert function and replace it with this:

```lua
alert = function()
  if GetResourceState('piotreq_gmt') == 'started' or GetResourceState('pp-ems-mdt') == 'started' then
      TriggerServerEvent('p_ambulancejob/server/editable/alert')
      return
  end

  local coords = lib.callback.await('p_ambulancejob/server/editable/getPlyCoords', false)
  if GetResourceState('redutzu-ems') == 'started' then
      TriggerEvent('redutzu-ems:client:addDispatchToEMS', {
          code = '911',
          title = 'Alert 911',
          street = GetStreetNameFromHashKey(GetStreetNameAtCoord(coords.x, coords.y, coords.z)),
          gender = GetEntityModel(cache.ped) == `mp_f_freemode_01` and 'female' or 'male',
          duration = (5 * 60 * 60),
          coords = {x = coords.x, y = coords.y, z = coords.z}
      })
  end

  if GetResourceState('op-ambulancemdt') == 'started' then
      TriggerServerEvent('op-ambulancemdt:SendDispatchAlert', 
          "ambulance", 
          'Alert 911', 
          "A person collapsed on the sidewalk and is not responding", 
          "red", 
          "fa-solid fa-truck-medical", 
          coords
      )
  end

  if Bridge.Dispatch and Bridge.Dispatch.SendAlert then
      Bridge.Dispatch.SendAlert({
          job = {'ambulance'},
          code = '911',
          title = 'Alert',
          coords = coords,
          time = 60,
          priority = 'normal',
          icon = 'fa solid fa-skull',
          blip = {
              sprite = 153,
              color = 1,
              length = 1,
              scale = 1.1,
              name = 'Medical Emergency',
          }
      })
  else
      TriggerServerEvent('p_ambulancejob/server/alerts/new', {
          code = '911',
          title = 'Alert',
          message = 'I need help!',
          coords = coords,
          expire = 60, -- 60 seconds
          blip = {
              sprite = 153,
              color = 1,
              scale = 1.1,
              pulse = true
          }
      })
  end
end
```

{% endstep %}

{% step %}

### EMS Tablet function (optional)

If you're using radial, find Config.Radial and set emsTablet item to this:

```lua
{
    id = 'emsTablet',
    icon = 'tablet',
    label = locale('tablet'),
    onSelect = function()
        if GetResourceState('piotreq_gmt') == 'started' then
            TriggerEvent('piotreq_gmt:OpenGMT')
        elseif GetResourceState('tk_mdt') == 'started' then
            exports['tk_mdt']:openUI('ambulance')
        elseif GetResourceState('lb-tablet') == 'started' then
            TriggerEvent('tablet:toggleOpen')
        elseif GetResourceState('kartik-mdt') == 'started' then
            exports['kartik-mdt']:openMDT()
        elseif GetResourceState('qf_mdt') == 'started' then
            exports['qf_mdt']:OpenMDT()
        elseif GetResourceState('op-ambulancemdt') == 'started' then
            TriggerEvent('op-ambulancemdt:openMDT')
        else
            lib.print.error('You are not using supported MDT! Add it in config.lua')
        end
    end
},
```

{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.otherplanet.dev/scripts/op-ambulance-mdt/integrations/p_ambulancejob.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
