p_ambulancejob

1

Find Directory

Go to p_ambulancejob/shared/config.lua

Find alert function and replace it with this:

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
2

EMS Tablet function (optional)

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

{
    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
},

Last updated