Browse docs

Minigames

Reference for Minigames in ambulancejob.

All client exports

Minigames

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.

StartMinigame(type, options?)

  • 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").
TypeDescription
"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

Message overrides

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.

bandage_wrap

KeyDefaultNote
title(per variant)Overrides the variant-specific title
titles.armApply arm gauze wrap
titles.legApply leg gauze wrap
titles.headApply head gauze wrap
titles.torsoStabilize torso gauze wrap
subtitleFollow the spiral path and stay close to the guide.
hintStart at the highlighted point and wrap upward in a spiral.
failToo far away - try again!

cpr / cpr_compressions

KeyDefaultNote
compressActionPress Space or click with the rhythm
missLabelMisses {count}/{max}Supports {count}, {max}
cycleLabelCycle {count}/{total}Supports {count}, {total}
phaseCompressions{count} compressionsSupports {count}
phaseVentilationDeliver {count} breathsOnly in full cpr mode
ventilationStageTitleRescue breathsOnly in full cpr mode
ventilationStageSubtitleTrace the mask alignment to deliver airflow.Only in full cpr mode
ventilationProgressBreaths {count}/{total}Only in full cpr mode

cpr_ventilation

KeyDefault
ventilationTitleDeliver rescue breaths
ventilationSubtitleTrace the airflow curve to deliver a breath.
ventilationHintStart at the highlighted marker and follow the wave.
ventilationFailBreath lost - reset and try again.
failTimeoutVentilation aborted - too slow.

bullet_extraction

KeyDefault
titleExtract the bullet
subtitleDrag the bullet straight up without touching the canal walls.
hintStay centered between the glowing rails.
progressExtraction progress
exitExit
failWall contact! Try again.
successBullet removed.
bulletAltDeformed bullet

saline_infusion

KeyDefaultNote
titleSaline infusion
subtitleRegulate the drip and keep the flow steady.
rateDrip rate
progressInfusion progress
stopAbort infusion
targetHintKeep between {low}–{high} drops/minSupports {low}, {high}
adjustAdjust the clamp into the highlighted zone.
successFlow is stable.
failOverFlow too high!
failUnderLine collapsed - reopen the clamp.
failTimeoutInfusion aborted - took too long.
progressHintKeep steady… {value}%Supports {value}

blood_transfusion

KeyDefaultNote
titleBlood transfusion setup
subtitleStabilise the transfusion flow.
rateFlow rate
progressInfusion progress
stopAbort transfusion
adjustAdjust the regulator into the highlighted zone.
stageCompleteFlow stabilised.
failOverFlow too strong! Slow down.
failUnderLine collapsed! Raise the flow.
failTimeoutTransfusion aborted - procedure took too long.
progressHintHold steady… {value}%Supports {value}

bag_valve_mask

KeyDefault
titleBag valve mask ventilation
subtitleTrace the airflow curve to deliver a breath.
hintStart at the highlighted marker and follow the wave.
progressBreaths {count}/{total}
successBreathBreath 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.

IsMinigameActive()

  • Purpose: Checks if a standalone minigame is currently running.
  • Returns: boolean
if exports["sky_ambulancejob"]:IsMinigameActive() then
    print("A minigame is in progress")
end

GetActiveMinigame()

  • Purpose: Returns the type of the currently active standalone minigame.
  • Returns: string | nil
local active = exports["sky_ambulancejob"]:GetActiveMinigame()

CancelMinigame()

  • Purpose: Cancels the currently running standalone minigame. The minigame counts as failed.
exports["sky_ambulancejob"]:CancelMinigame()

GetAvailableMinigames()

  • 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

Example: Using minigames in another resource

-- 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)