☰ All guides
ESX

6-deathscreen

Death screen with bleed-out timer, dispatch and sync buttons and a small jump game with highscore to pass the time.

Resource folder

six_deathscreen

01Requirements

  • ESX Legacy (the script gets ESX through the es_extended export).
  • esx_ambulancejob
  • oxmysql

02Installation

  1. 01Sign in to the Cfx Portal with the account you bought with and download the script under Granted Assets.
  2. 02Unzip the download and move the folder six_deathscreen into the resources folder of your server. Keep the folder name and upload every file, including the hidden .fxap.
  3. 03Run highscore.sql in your database. It adds the column highscore to the table users.
  4. 04If your ambulance job folder has another name, enter it in Config.General.AmbulanceName.
  5. 05Add ensure six_deathscreen to your server.cfg, below es_extended, oxmysql and esx_ambulancejob.
  6. 06Restart the server (or run refresh and then ensure with the folder name in the server console).
highscore.sql
ALTER TABLE users ADD highscore INT NOT NULL DEFAULT '0';

03What players see

  • A timer that counts down the bleed-out time. When it ends the player can respawn at Config.Respawn.coords.
  • Dispatch: calls the function dispatch() from the config. It is empty by default, see below.
  • Sync: resets the player's position if the body got stuck or is shown wrong.
  • Mini-game: press space to play. The highscore is saved per player.

04Configuration

Option

General.AmbulanceName
Folder name of your ambulance job.
General.BleedoutTimer
Time until the player bleeds out, in milliseconds. Default 10 minutes.
General.DispatchCooldown
Wait time between two dispatch calls. Default 3 minutes.
General.SyncCooldown
Wait time between two syncs. Default 20 seconds.
Respawn.coords
Where players respawn, usually the hospital.
Respawn.RemoveItemsCallback
Callback of esx_ambulancejob that removes items after death. Only change it if you renamed it there. What players keep is set in the config of esx_ambulancejob.
dispatch()
Put the call to your dispatch system here.
sync()
What the sync button does. Contains the notification text.

Example for dispatch(). Replace the event with the one of your dispatch resource:

lua
function dispatch()
    local coords = GetEntityCoords(PlayerPedId())
    TriggerServerEvent("your_dispatch:server:notify", "ambulance", "Unconscious person", coords)
end
›config.luaComplete file · 29 lines
config.lua
Config = {}

Config.General = {
    AmbulanceName = 'esx_ambulancejob', -- Folder name of the ambulancejob

    -- Time in milliseconds
    BleedoutTimer = 10 * 60000, -- Time til player bleeds out
    DispatchCooldown = 3 * 60000,
    SyncCooldown = 20000,
}

Config.Respawn = {
    coords = vector4(354.98013305664, -597.76129150391, 28.770942687988, 252.55599975586),
    -- Change what the player is allowed to keep in Inventory esx_ambulancejob/config.lua exactly on lines 24-26
    RemoveItemsCallback = 'esx_ambulancejob:removeItemsAfterRPDeath', -- Don't change unless you nothing changed in esx_ambulancejob
}

function dispatch()
    -- Dispatch code here
end

function sync()
    local playerPed = PlayerPedId()
    local coords    = GetEntityCoords(playerPed)
    ClearPedTasksImmediately(PlayerPedId())
    SetEntityCoords(PlayerPedId(), coords.x, coords.y, coords.z)

    ESX.ShowNotification("Du hast dich ~o~synchronisiert")
end

05Troubleshooting

SQL error “Unknown column 'highscore'”

highscore.sql was not imported.

The dispatch button does nothing.

dispatch() in the config is empty until you add your dispatch call.

06Still stuck?

Open a ticket on our Discord. Send the script name, your framework and version, and the full error from the server console (F8 for client errors). That saves a round of questions.