Installation Guide
This guide walks you through the installation and configuration process for our Deathscreen script. Before proceeding, ensure you've followed the general script setup steps outlined in the general installation guide.
βοΈ Ambulance Job Integrationβ
- esx_ambulancejob
- qb-ambulancejob
- visn_are
- osp_ambulance
- wasabi_ambulance
ESX Ambulancejobβ
1. Add Exportβ
Add this line at the bottom of client/main.lua
in esx_ambulancejob
:
exports("RemoveItemsAfterRPDeath", RemoveItemsAfterRPDeath)
2. Disable Native Death Screenβ
Search for the OnPlayerDeath
function call and comment it out in the same file:
AddEventHandler('esx:onPlayerDeath', function(data)
-- OnPlayerDeath()
end)
QB Ambulancejobβ
1. Remove Death Timerβ
Search for the gameEventTriggered
handler in client/dead.lua
and comment out the DeathTimer()
function call
AddEventHandler('gameEventTriggered', function(event, data)
if event == 'CEventNetworkEntityDamage' then
local victim, attacker, victimDied, weapon = data[1], data[2], data[4], data[7]
if not IsEntityAPed(victim) then return end
if victimDied and NetworkGetPlayerIndexFromPed(victim) == PlayerId() and IsEntityDead(PlayerPedId()) then
if not InLaststand then
SetLaststand(true)
elseif InLaststand and not isDead then
SetLaststand(false)
local playerid = NetworkGetPlayerIndexFromPed(victim)
local playerName = GetPlayerName(playerid) .. ' ' .. '(' .. GetPlayerServerId(playerid) .. ')' or Lang:t('info.self_death')
local killerId = NetworkGetPlayerIndexFromPed(attacker)
local killerName = GetPlayerName(killerId) .. ' ' .. '(' .. GetPlayerServerId(killerId) .. ')' or Lang:t('info.self_death')
local weaponLabel = (QBCore.Shared.Weapons and QBCore.Shared.Weapons[weapon] and QBCore.Shared.Weapons[weapon].label) or 'Unknown'
local weaponName = (QBCore.Shared.Weapons and QBCore.Shared.Weapons[weapon] and QBCore.Shared.Weapons[weapon].name) or 'Unknown'
TriggerServerEvent('qb-log:server:CreateLog', 'death', Lang:t('logs.death_log_title', { playername = playerName, playerid = GetPlayerServerId(playerid) }), 'red', Lang:t('logs.death_log_message', { killername = killerName, playername = playerName, weaponlabel = weaponLabel, weaponname = weaponName }))
deathTime = Config.DeathTime
OnDeath()
-- DeathTimer()
end
end
end
end)
2. Remove Native Death Screenβ
Locate the main thread and comment out the following lines:
CreateThread(function()
while true do
local sleep = 1000
if isDead or InLaststand then
sleep = 5
local ped = PlayerPedId()
if IsPauseMenuActive() then
SetFrontendActive(false)
end
DisableAllControlActions(0)
EnableControlAction(0, 1, true)
EnableControlAction(0, 2, true)
EnableControlAction(0, 245, true)
EnableControlAction(0, 38, true)
EnableControlAction(0, 0, true)
EnableControlAction(0, 322, true)
EnableControlAction(0, 288, true)
EnableControlAction(0, 213, true)
EnableControlAction(0, 249, true)
EnableControlAction(0, 46, true)
EnableControlAction(0, 47, true)
if isDead then
-- if not isInHospitalBed then
-- if deathTime > 0 then
-- DrawTxt(0.93, 1.44, 1.0, 1.0, 0.6, Lang:t('info.respawn_txt', { deathtime = math.ceil(deathTime) }), 255, 255, 255, 255)
-- else
-- DrawTxt(0.865, 1.44, 1.0, 1.0, 0.6, Lang:t('info.respawn_revive', { holdtime = hold, cost = Config.BillCost }), 255, 255, 255, 255)
-- end
-- end
if IsPedInAnyVehicle(ped, false) then
loadAnimDict('veh@low@front_ps@idle_duck')
if not IsEntityPlayingAnim(ped, 'veh@low@front_ps@idle_duck', 'sit', 3) then
TaskPlayAnim(ped, 'veh@low@front_ps@idle_duck', 'sit', 1.0, 1.0, -1, 1, 0, 0, 0, 0)
end
else
if isInHospitalBed then
if not IsEntityPlayingAnim(ped, inBedDict, inBedAnim, 3) then
loadAnimDict(inBedDict)
TaskPlayAnim(ped, inBedDict, inBedAnim, 1.0, 1.0, -1, 1, 0, 0, 0, 0)
end
else
if not IsEntityPlayingAnim(ped, deadAnimDict, deadAnim, 3) then
loadAnimDict(deadAnimDict)
TaskPlayAnim(ped, deadAnimDict, deadAnim, 1.0, 1.0, -1, 1, 0, 0, 0, 0)
end
end
end
SetCurrentPedWeapon(ped, `WEAPON_UNARMED`, true)
elseif InLaststand then
sleep = 5
-- if LaststandTime > Config.MinimumRevive then
-- DrawTxt(0.94, 1.44, 1.0, 1.0, 0.6, Lang:t('info.bleed_out', { time = math.ceil(LaststandTime) }), 255, 255, 255, 255)
-- else
-- DrawTxt(0.845, 1.44, 1.0, 1.0, 0.6, Lang:t('info.bleed_out_help', { time = math.ceil(LaststandTime) }), 255, 255, 255, 255)
-- if not emsNotified then
-- DrawTxt(0.91, 1.40, 1.0, 1.0, 0.6, Lang:t('info.request_help'), 255, 255, 255, 255)
-- else
-- DrawTxt(0.90, 1.40, 1.0, 1.0, 0.6, Lang:t('info.help_requested'), 255, 255, 255, 255)
-- end
-- if IsControlJustPressed(0, 47) and not emsNotified then
-- TriggerServerEvent('hospital:server:ambulanceAlert', Lang:t('info.civ_down'))
-- emsNotified = true
-- end
-- end
if not isEscorted then
if IsPedInAnyVehicle(ped, false) then
loadAnimDict('veh@low@front_ps@idle_duck')
if not IsEntityPlayingAnim(ped, 'veh@low@front_ps@idle_duck', 'sit', 3) then
TaskPlayAnim(ped, 'veh@low@front_ps@idle_duck', 'sit', 1.0, 1.0, -1, 1, 0, 0, 0, 0)
end
else
loadAnimDict(lastStandDict)
if not IsEntityPlayingAnim(ped, lastStandDict, lastStandAnim, 3) then
TaskPlayAnim(ped, lastStandDict, lastStandAnim, 1.0, 1.0, -1, 1, 0, 0, 0, 0)
end
end
else
if IsPedInAnyVehicle(ped, false) then
loadAnimDict('veh@low@front_ps@idle_duck')
if IsEntityPlayingAnim(ped, 'veh@low@front_ps@idle_duck', 'sit', 3) then
StopAnimTask(ped, 'veh@low@front_ps@idle_duck', 'sit', 3)
end
else
loadAnimDict(lastStandDict)
if IsEntityPlayingAnim(ped, lastStandDict, lastStandAnim, 3) then
StopAnimTask(ped, lastStandDict, lastStandAnim, 3)
end
end
end
end
end
Wait(sleep)
end
end)
visn_areβ
1. Add Exportβ
Add this line at the bottom of helpers/c_functions.lua
in visn_are
:
exports("RespawnPlayer", function()
RespawnPlayer(ClientData.coords, TempAuthToken)
end)
2. Remove Native Death Screenβ
Locate window.addEventListener
in html/app.js
and comment out toggleUnconsciousScreen
like this:
case "forcedUpdateBodyPartInformation":
_showInjuries(selectedBodyPart, _getBodyPartInjuries(selectedBodyPart));
_getAvailableActionsForCategory(lastActionCategory, selectedBodyPart);
break;
case "toggleTriageSelection":
event.data.payloadData ? $(".triageSelection").show() : $(".triageSelection").hide();
// case "toggleUnconsciousScreen":
// if (event.data.payloadData.value) {
// $(".remaining_time").hide();
// $(".remaining_time").text(`00:00 ${_translateText("MINUTES_REMAINING")}`);
// }
// event.data.payloadData.value ? $(".unconsciousScreen").fadeIn("fast") : $(".unconsciousScreen").fadeOut("fast");
// break;
case "toggleAnesthesiaScreen":
event.data.payloadData.value ? $(".anesthesiaScreen").fadeIn("fast") : $(".anesthesiaScreen").fadeOut("fast");
break;
case "updateUnconsciousTime":
const minutes = Math.floor(event.data.payloadData.seconds / 60);
$(".remaining_time").text(`${minutes.toString().padStart(2, "0")}:${(event.data.payloadData.seconds % 60).toString().padStart(2, "0")} ${_translateText("MINUTES_REMAINING")}`);
$(".unconsciousScreen .progressbar").css("width", event.data.payloadData.seconds / event.data.payloadData.max_seconds * 100 + "%");
if ($(".remaining_time").css("display") == "none") $(".remaining_time").fadeIn("fast");
break;
3. Remove Native Deathscreen Logicβ
Locate the function HandleUnconsciousScreen(bloodVolume)
in c_functions.lua
and comment out all lines within the function, like so:
function HandleUnconsciousScreen(bloodVolume)
-- local remainingSeconds = GetRemainingUnconsciousSeconds(ClientHealthBuffer)
--
-- SendNUIMessage({
-- payload = "updateUnconsciousTime",
-- payloadData = {
-- seconds = remainingSeconds,
-- max_seconds = ClientHealthBuffer.unconsciousTimeUntilDeath
-- }
-- })
--
-- if GetGameTimer() - LastDispatch > ClientConfig.m_emergencyDispatch.cooldown * 1000 and LastDispatchHidden then
-- SendNUIMessage({
-- payload = "toggleDispatchInfo",
-- payloadData = {
-- value = (ClientConfig.m_emergencyDispatch.enabled and ClientConfig.m_configurableKeys.keys.EMERGENCY_DISPATCH.enabled) and not ClientHealthBuffer.bodybag,
-- key = ClientConfig.m_configurableKeys.m_useInputMapper
-- and GetControlStringFromKeyMapping("emergency_dispatch")
-- or GetControlStringFromKeyMappingNoInputMapper(ClientConfig.m_configurableKeys.keys.EMERGENCY_DISPATCH.control_id)
-- }
-- })
--
-- LastDispatchHidden = false
-- end
--
-- if not CheckForCriticalVitals(bloodVolume) and math.random(0, 100) > 75 and
-- (
-- ClientHealthBuffer.heartRate > 50 and
-- ClientHealthBuffer.bloodVolume > ENUM_BLOOD_VOLUME_CLASSES.CLASS_4_HERMORRHAGE) then
-- SetUnconsciousState(false)
-- end
--
-- if ClientHealthBuffer.unconscious and remainingSeconds == 0 then
-- if ClientConfig.m_allowManualRespawnWhileBeingUnconscious then
-- SendNUIMessage({
-- payload = "showManualRespawnText",
-- payloadData = {
-- value = ClientConfig.m_configurableKeys.keys.MANUAL_RESPAWN.enabled,
-- key = ClientConfig.m_configurableKeys.m_useInputMapper
-- and GetControlStringFromKeyMapping("manual_respawn")
-- or GetControlStringFromKeyMappingNoInputMapper(ClientConfig.m_configurableKeys.keys.MANUAL_RESPAWN.control_id)
-- }
-- })
-- else
-- RespawnPlayer(ClientData.coords, TempAuthToken)
-- end
-- end
end
OSP Ambulanceβ
1. Edit Configβ
Enable CustomDeathScreen
in osp_ambulance config.lua
Config.CustomDeathScreen = true
2. Add Export for Dispatchβ
Add this line at the bottom of client_open
in osp_ambulance
:
exports("dispatchNotify", dispatchNotify)
Wasabi Ambulanceβ
1. Add Exportsβ
Add this lines at the bottom of game/client/cl_customize.lua
in wasabi_ambulance
:
exports("SendDistressSignal", SendDistressSignal)
exports("StartRPDeath", StartRPDeath)
2. Remove Native Deathscreen Logicβ
Locate the function StartDeathTimer()
in game/client/cl_customize.lua
and comment out all lines within the function:
function StartDeathTimer()
-- all
-- code
-- inside
-- needs to
-- be commented out
end
Discord Logsβ
You can find instructions here Discord Webhooks
Final Stepsβ
- Restart your server.
- Test the deathscreen integration with your chosen ambulance job script.
If you experience any issues or have further questions, please don't hesitate to reach out to our support team on Discord. We're here to help!