Browse docs

Supported FFA Scripts

Integrate supported FFA and faction-fight scripts with the Sky Ambulance Job death, injury, and revive flows.

Supported scripts

Sky Ambulance Job supports the following FFA, paintball, and faction-fight integrations through Config.Functions.beforeDeath and Config.Functions.beforeInjuries.

The integration prevents the ambulance death screen and injury system from taking control while the player is participating in an FFA or faction fight. The ESX-compatible player death event is still sent so the external script can run its own death and revive flow.

nass_paintball

  • Mode: Paintball
  • Resource: nass_paintball
  • State export: exports["nass_paintball"]:inGame()

The ambulance death and injury flows are blocked while inGame() returns true.

ws_ffa-v2

  • Mode: FFA zone
  • Resource: ws_ffa-v2
  • State export: exports["ws_ffa-v2"]:isInZone()

The ambulance death and injury flows are blocked while isInZone() returns true.

ws_gangwar-v2

  • Mode: Gangwar
  • Resource: ws_gangwar-v2
  • State export: exports["ws_gangwar-v2"]:isFightActive()

The ambulance death and injury flows are blocked while isFightActive() returns true.

sp_ffa

  • Mode: FFA
  • Resource: sp_ffa
  • State export: exports["sp_ffa"]:inFFA()

The ambulance death and injury flows are blocked while inFFA() returns true. This integration also requires the OnRevive(lastWeapon) adjustment documented below.

sp_frakfights

  • Mode: Faction fight
  • Resource: sp_frakfights
  • State export: exports["sp_frakfights"]:IsFrakFight()

The ambulance death and injury flows are blocked while IsFrakFight() returns true.

Generate the functions.lua hooks

Select the scripts installed on your server. The generator prepares the complete hook block for sky_ambulancejob/config/functions.lua.

Open the original functions.lua

Open sky_ambulancejob/config/functions.lua. Do not delete or replace the complete file.

Find the replacement start

Start at the comment directly above this function:

Config.Functions.beforeDeath = function(context)

Find the replacement end

The replacement ends after the closing end of:

Config.Functions.beforeInjuries = function(context)

Stop immediately before this comment and function:

-- Optional client-only hook that runs after a revive finishes.
Config.Functions.onRevive = function()

Generate and paste

Select the installed scripts below, copy the generated configuration, and replace only the marked beforeDeath/beforeInjuries section.

functions.lua generator

Select your fight scripts

Choose every script running on your server. The generated hooks only call exports from resources that are installed and started.

Replace only the death and injury hook section. Stop before Config.Functions.onRevive. Keep that function and every function below it in your original file.
Generated configuration0 selected
-- Select at least one supported script above.

Keep Config.Functions.onRevive, Config.Functions.onDeath, Config.Functions.onRespawn, Config.Functions.onAiMedicRequest, Config.Functions.sendDispatch, and every other function outside the marked replacement range unchanged.

Returning false from beforeDeath disables the Sky Ambulance Job death flow for that death. Returning false from beforeInjuries prevents Sky injuries from being generated while the player is inside the external game mode.

The generated resource-state checks ensure that only installed and running integrations are called.

sp_ffa: Update the revive callback

This section applies only to sp_ffa. Its OnRevive(lastWeapon) callback must wait until Sky Ambulance Job has completely rebuilt the player ped. Otherwise, selecting the previous weapon can happen before NetworkResurrectLocalPlayer finishes.

Replace the existing OnRevive(lastWeapon) callback in sp_ffa with:

sp_ffa\config\sh_config.lua
function OnRevive(lastWeapon)
    CreateThread(function()
        local timeout = GetGameTimer() + 8000

        while LocalPlayer.state.skyAmbulanceReviveState ~= "finished"
            and LocalPlayer.state.skyAmbulanceReviveState ~= "failed"
            and GetGameTimer() < timeout do
            Wait(10)
        end

        if LocalPlayer.state.skyAmbulanceReviveState ~= "finished" then
            return
        end

        local weaponHash = tonumber(lastWeapon)

        if not weaponHash and type(lastWeapon) == "string" then
            weaponHash = joaat(lastWeapon)
        end

        local ped = PlayerPedId()

        if not HasPedGotWeapon(ped, weaponHash, false) then
            GiveWeaponToPed(ped, weaponHash, 0, false, false)
        end

        SetCurrentPedWeapon(ped, weaponHash, true)
    end)
end

SetCurrentPedWeapon can only select a weapon that already exists on the current ped. NetworkResurrectLocalPlayer can rebuild the ped without its previous native weapon, so the callback uses GiveWeaponToPed before selecting it.

The lastWeapon argument restores the weapon model only. If the FFA script also needs to preserve ammunition, components, or tint, it must save those values before death and restore them in this callback as well.

Revive state

Sky Ambulance Job exposes the local skyAmbulanceReviveState player StateBag for client-side integrations:

ValueMeaning
"reviving"The revive flow is currently rebuilding the player.
"finished"The player has been completely revived.
"failed"The revive flow could not complete.

The StateBag is local to the player and can be read from other client resources through LocalPlayer.state.skyAmbulanceReviveState.

Support

Need help? Our support team is always ready to assist

Join Discord