Purpose: Updates the AI medic status shown on the death screen UI. Use this when you override the built-in AI medic via Config.Functions.onAiMedicRequest and need to update the UI from your own system.
Arguments:
state (string): One of "idle", "requesting", "dispatched", "driving", "arrived", "reviving", "finished", "failed", "cooldown".
reason (string?): Optional failure reason when state is "failed" — "not_enough_money", "medics_online", "spawn_failed", "disabled".
-- Show "AI medic on the way"
exports["sky_ambulancejob"]:setAiMedicState("driving")
-- Show failure
exports["sky_ambulancejob"]:setAiMedicState("failed", "spawn_failed")
-- Reset to idle
exports["sky_ambulancejob"]:setAiMedicState("idle")
Purpose: Checks if the AI medic is currently active or pending.
Returns: boolean
local active = exports["sky_ambulancejob"]:isAiMedicActive()
To override the built-in AI medic with your own system, use the Config.Functions.onAiMedicRequest hook in config/functions.lua. Return false to prevent the default AI medic from dispatching, then use the exports above to update the death screen UI.
-- config/functions.lua
Config.Functions.onAiMedicRequest = function()
exports['my-medic-resource']:sendHelp()
return false -- prevent built-in AI medic
end
Purpose: Opens the full diagnose UI on the local player, allowing them to inspect and treat their own injuries. Requires Config.SelfDiagnose.enabled = true. When Config.SelfDiagnose.requireMedicJob is true (default), only on-duty medics can use this export.
Returns:
boolean: true when the diagnose UI was opened successfully.
string?: Reason when the call fails — "disabled", "no_permission", "busy", "dead".
local success, reason = exports["sky_ambulancejob"]:OpenSelfDiagnose()
if not success then
print("Self-diagnose failed: " .. (reason or "unknown"))
end
This export can also be triggered via the /selfdiagnose chat command (configurable in Config.SelfDiagnose.command) or via the Self-diagnose radial menu action.
Purpose: Opens the interactive stretcher positioning editor for vehicle attachment configuration. Spawns a preview vehicle with an attached stretcher that can be repositioned via keyboard controls.
Arguments:
payload (table):
model (string | number) — Vehicle model name or hash. Required.
name (string?) — Optional display name for the vehicle.
Returns: table with:
success (boolean) — true when the editor opened successfully.
error (string?) — Error message when success is false.
local result = exports["sky_ambulancejob"]:openStretcherEditor({
model = "ambulance",
name = "Ambulance"
})
if not result.success then
print("Error: " .. result.error)
end
The ambulancejob minigames can be used standalone from any other resource. Each export opens the minigame UI and yields until the player completes or fails it.
Purpose: Starts any minigame by type. This is the universal entry point for all standalone minigames.
Arguments:
type (string): The minigame to start — see table below.
options (table?): Optional configuration.
variant (string?): For bandage_wrap only — "arm", "leg", "head", or "torso" (default "arm").
messages (table?): Override any display text in the minigame UI. Keys match the short locale keys of each component (e.g. title, subtitle, hint, fail, success). Any key not provided falls back to the default locale string.
Returns:
boolean: true when the minigame started, false on error.
boolean | string: When started — true on success, false on fail. When not started — error reason ("invalid_type", "busy").
Type
Description
"bandage_wrap"
Trace a spiral path to wrap a wound. Accepts variant option.
"cpr"
Full CPR — hit compression beats at rhythm, then deliver rescue breaths.
"cpr_compressions"
Chest compressions only (no ventilation phase).
"cpr_ventilation"
Rescue breaths only (trace the airflow wave).
"bullet_extraction"
Drag a bullet upward through a canal without hitting the walls.
"saline_infusion"
Regulate IV drip flow by adjusting a clamp to the target rate.
"blood_transfusion"
Control blood flow rate within the target zone.
"bag_valve_mask"
Trace an airflow wave to deliver breaths (3 breaths required).
local started, result = exports["sky_ambulancejob"]:StartMinigame("cpr")
if started and result then
print("CPR successful!")
end
Every minigame component resolves its display text through short keys. Pass a messages table to override any of them:
local started, success = exports["sky_ambulancejob"]:StartMinigame("bullet_extraction", {
messages = {
title = "Remove the splinter",
subtitle = "Carefully pull it out without touching the walls.",
fail = "Wall contact!",
success = "Removed!",
}
})
Keys that are not provided in the table fall back to the configured locale. Below is the full key reference for each minigame type.
Start at the highlighted marker and follow the wave.
progress
Breaths {count}/{total}
successBreath
Breath delivered
StartMinigame is yielding — it blocks the current thread until the player finishes or cancels the minigame. Call it inside a CreateThread or Citizen.CreateThread to avoid blocking your main thread.
Purpose: Returns a table of all minigame types with their enabled/disabled state from Config.Minigames.enabled.
Returns: table<string, boolean>
local available = exports["sky_ambulancejob"]:GetAvailableMinigames()
for name, enabled in pairs(available) do
print(name .. ": " .. tostring(enabled))
end
-- In your custom resource (client-side)
CreateThread(function()
-- Example: require a CPR minigame before reviving
local started, success = exports["sky_ambulancejob"]:StartMinigame("cpr")
if started and success then
TriggerServerEvent("myresource:revivePlayer")
else
TriggerEvent("chat:addMessage", {
args = { "CPR failed — the patient could not be revived." }
})
end
end)
-- Example: bandage wrap as a skill check with custom text
RegisterCommand("applybandage", function()
CreateThread(function()
local started, success = exports["sky_ambulancejob"]:StartMinigame("bandage_wrap", {
variant = "arm",
messages = {
title = "Apply field dressing",
subtitle = "Wrap the wound carefully.",
}
})
if started and success then
print("Bandage applied successfully")
end
end)
end)