Ambulance Dispatch

This system is not exclusive to esx, but we will give the example here since qbcore comes with its own integrated system and such modification is not necessary. But you can invent interesting things whether you use esx or qbcore.

Both examples were run using esx_ambulancejob, if you use another asset you will need to adapt it to make it perfect for your scenario.

Quasar Smartphone has a very comfortable system for sending messages to workers, which can be used through ambulance, as in this example, where we will create a dispatch that will be launched when a player dies and it will notify the ambulance in your city giving the location. .

Can I add this to qbcore?

Actually you can, but it is not necessary since qbcore has its own native events for these situations. In any case, the snippet is useful for any scenario.

What suits me? Business or Message?

Personally, we like Business more since we can have a better activity with the player by using this option. Message will only send a message which we will not be able to have as much interaction, but in essence, it is the same.


Ambulance Dispatch through Business app

We can use the dispatch system through the business app using the following code. Remember that we will give all the examples using esx_ambulancejob, you can use another asset and adapt it your way, customizing it and leaving it ready for your server.

function SendDistressSignal()
  local playerPed = PlayerPedId()
  local coords = GetEntityCoords(playerPed)
  local message = "Injured person" -- The message that will be received.
  local alert = {
      message = message,
      -- img = "img url", -- You can add image here (OPTIONAL).
      location = coords,
  }

  TriggerServerEvent('qs-smartphone:server:sendJobAlert', alert, "ambulance") -- "Your ambulance job"
  TriggerServerEvent('qs-smartphone:server:AddNotifies', {
      head = "Google My Business", -- Message name.
      msg = message,
      app = 'business'
  })
end 

Ambulance Dispatch using Messages app

The option via Messages is not a bad option but we will prefer to use the superior Business option, in any case we will leave the snippet and its use below.

function SendDistressSignal()
    local playerPed = PlayerPedId()
    local coords = GetEntityCoords(playerPed)

    TriggerEvent('qs-smartphone:sendJobMessage', {
        phone = 'ambulance', 
        type = 'message', 
        message = 'Injured person'
    })
    Wait(300)
    TriggerEvent('qs-smartphone:sendJobMessage', {
        phone = 'ambulance', 
        type = 'location'
    })
end

Last updated

Was this helpful?