π₯οΈCode Snippets
Here are some examples of how you can integrate with specific scripts
QBCore: qb-ambulancejob custom checkin event
If you are using qb-ambulancejob, their eventqb-ambulancejob:checkin does a distance check in their check-in event that will prevent the player from checking in when dropped off outside by the AI EMS because they are too far from the checkin location.
The simplest way to fix this is to add a new checkin event that we will call from wp-ai-ems.
Here is an example of what a new event could look like that works with qb-ambulancejob.
-- This will check the player into the hospital that they spawn near
-- The hospitalIndex provided by wp-ai-ems must match the index for the hospital locations defined in this script
RegisterNetEvent('qb-ambulancejob:aiems-checkin', function(hospitalIndex)
QBCore.Functions.Progressbar("hospital_checkin", Lang:t('progress.checking_in'), 2000, false, true, {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
}, {}, {}, {}, function() -- Done
-- Gets a bed that is not occupied at this hospital to place the player in
local bedId = getClosestAvailableBed(hospitalIndex)
if bedId then
TriggerServerEvent("hospital:server:SendToBed", bedId, true, hospitalIndex)
hospitalLocation = hospitalIndex
-- HospitalOutfit() -- Optional if you have this defined
else
QBCore.Functions.Notify(Lang:t('error.beds_taken'), "error")
end
end)
end)PS-MDT: Dispatch AI EMS on downed person alerts from the MDT

At the bottom of
client/main.luaadd:
At the bottom of
server/main.luaadd:
In
ui/app.jswe need to make several changes to add the "Dispatch Local EMS" context menu itemLook for
$(".contextmenu").on("click", ".attached-units", function () {...}and under that code block add:Look for
const canRespond = $(this).data("canrespond");and add these lines beneath:Look for
if (canRespond == true) {...} elseif (canRespond == false) { ... }, after the if/else we want to add another conditional to make it only render this new item if its for civdown dispatchcodenameWe now need to add data attributes onto the items so we can pluck off the
playersourceanddispatchcodenames. Look forDispatchItem =there should be 4 results. Add the following attributes onto each of them:Look for
<li class="contextmenu-item ${value.className}" data-info="${value.info}" data-status="${value.status}and update to include the new attribute, you should now have:<li class="contextmenu-item ${value.className}" data-info="${value.info}" data-status="${value.status}" data-playersource="${value.playersource}">
In
ui/style.cssadd these lines:
Wasabi Ambulance Integration
If you use wasabi_ambulance and want to dispatch AI EMS as part of the distress signal, follow these snippets.
In
cl_customize.luafind theSendDistressSignalfunction and add thisTriggerServerEvent('hospital:server:RequestEMS').In
sv_customize.luaadd the following new event.Ensure that you have updated
Config.HospitalLocationsandConfig.DefaultHospitalto match the keys defined inwasabi-ambulance config.lua - Config.Locations.As of writing this (5/8/24), the key values should be updated to strings, where the string matches the hospital names you've configured.
Example:
Update
Config.HospitalCheckinEventto
Last updated