ESX
Disabling the ESX Ambulance Job Default Death Screen
To remove or disable the death screen in the ESX Ambulance Job, make adjustments to certain functions in client/main.lua
. The following instructions guide you through commenting out lines responsible for the visual effects and camera controls associated with the death screen.
Step 1: Add esx_ambulancejob:RespawnAtHospital
Event
esx_ambulancejob:RespawnAtHospital
EventLocate the RemoveItemsAfterRPDeath
function and insert the following line below it:
RegisterNetEvent("esx_ambulancejob:RespawnAtHospital", RemoveItemsAfterRPDeath)
Step 2: Modify esx:onPlayerSpawn
Event
esx:onPlayerSpawn
EventLocate the esx:onPlayerSpawn
event handler. Comment out the lines related to the death screen effects.
Original Code:
AddEventHandler('esx:onPlayerSpawn', function()
isDead = false
ClearTimecycleModifier()
SetPedMotionBlur(PlayerPedId(), false)
ClearExtraTimecycleModifier()
EndDeathCam()
if firstSpawn then
firstSpawn = false
if Config.SaveDeathStatus then
while not ESX.PlayerLoaded do
Wait(1000)
end
ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(shouldDie)
if shouldDie then
Wait(1000)
SetEntityHealth(PlayerPedId(), 0)
end
end)
end
end
end)
Updated Code:
AddEventHandler('esx:onPlayerSpawn', function()
isDead = false
ClearTimecycleModifier()
-- SetPedMotionBlur(PlayerPedId(), false)
-- ClearExtraTimecycleModifier()
-- EndDeathCam()
if firstSpawn then
firstSpawn = false
if Config.SaveDeathStatus then
while not ESX.PlayerLoaded do
Wait(1000)
end
ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(shouldDie)
if shouldDie then
Wait(1000)
SetEntityHealth(PlayerPedId(), 0)
end
end)
end
end
end)
Step 3: Modify OnPlayerDeath
Function
OnPlayerDeath
FunctionFind the OnPlayerDeath
function, then comment out the death screen and camera effect lines.
Original Code:
function OnPlayerDeath()
ESX.CloseContext()
ClearTimecycleModifier()
SetTimecycleModifier("REDMIST_blend")
SetTimecycleModifierStrength(0.7)
SetExtraTimecycleModifier("fp_vig_red")
SetExtraTimecycleModifierStrength(1.0)
SetPedMotionBlur(PlayerPedId(), true)
TriggerServerEvent('esx_ambulancejob:setDeathStatus', true)
StartDeathTimer()
StartDeathCam()
isDead = true
StartDeathLoop()
StartDistressSignal()
end
Updated Code:
function OnPlayerDeath()
ESX.CloseContext()
ClearTimecycleModifier()
-- SetTimecycleModifier("REDMIST_blend")
-- SetTimecycleModifierStrength(0.7)
-- SetExtraTimecycleModifier("fp_vig_red")
-- SetExtraTimecycleModifierStrength(1.0)
-- SetPedMotionBlur(PlayerPedId(), true)
TriggerServerEvent('esx_ambulancejob:setDeathStatus', true)
-- StartDeathTimer()
-- StartDeathCam()
isDead = true
StartDeathLoop()
-- StartDistressSignal()
end
Step 4: Modify StartDeathLoop
Function
StartDeathLoop
FunctionIn the StartDeathLoop
function, comment out the lines controlling the player's movement restrictions and camera controls. And don't forget to add the Wait(0)
.
Original Code:
function StartDeathLoop()
CreateThread(function()
while isDead do
DisableAllControlActions(0)
EnableControlAction(0, 47, true) -- G
EnableControlAction(0, 245, true) -- T
EnableControlAction(0, 38, true) -- E
ProcessCamControls()
if isSearched then
local playerPed = PlayerPedId()
local ped = GetPlayerPed(GetPlayerFromServerId(medic))
isSearched = false
AttachEntityToEntity(playerPed, ped, 11816, 0.54, 0.54, 0.0, 0.0, 0.0, 0.0, false, false, false, false, 2, true)
Wait(1000)
DetachEntity(playerPed, true, false)
ClearPedTasksImmediately(playerPed)
end
end
end)
end
Updated Code:
function StartDeathLoop()
CreateThread(function()
while isDead do
-- DisableAllControlActions(0)
-- EnableControlAction(0, 47, true) -- G
-- EnableControlAction(0, 245, true) -- T
-- EnableControlAction(0, 38, true) -- E
-- ProcessCamControls()
if isSearched then
local playerPed = PlayerPedId()
local ped = GetPlayerPed(GetPlayerFromServerId(medic))
isSearched = false
AttachEntityToEntity(playerPed, ped, 11816, 0.54, 0.54, 0.0, 0.0, 0.0, 0.0, false, false, false, false, 2, true)
Wait(1000)
DetachEntity(playerPed, true, false)
ClearPedTasksImmediately(playerPed)
end
Wait(0)
end
end)
end
Step 5: Modify esx_ambulancejob:revive
Event
esx_ambulancejob:revive
EventIn the esx_ambulancejob:revive
event handler, comment out the lines that are related to the death screen.
Original Code:
RegisterNetEvent('esx_ambulancejob:revive')
AddEventHandler('esx_ambulancejob:revive', function()
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
TriggerServerEvent('esx_ambulancejob:setDeathStatus', false)
DoScreenFadeOut(800)
while not IsScreenFadedOut() do
Wait(50)
end
local formattedCoords = {x = ESX.Math.Round(coords.x, 1), y = ESX.Math.Round(coords.y, 1), z = ESX.Math.Round(coords.z, 1)}
RespawnPed(playerPed, formattedCoords, 0.0)
isDead = false
ClearTimecycleModifier()
SetPedMotionBlur(playerPed, false)
ClearExtraTimecycleModifier()
EndDeathCam()
DoScreenFadeIn(800)
end)
Updated Code:
RegisterNetEvent('esx_ambulancejob:revive')
AddEventHandler('esx_ambulancejob:revive', function()
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
TriggerServerEvent('esx_ambulancejob:setDeathStatus', false)
DoScreenFadeOut(800)
while not IsScreenFadedOut() do
Wait(50)
end
local formattedCoords = {x = ESX.Math.Round(coords.x, 1), y = ESX.Math.Round(coords.y, 1), z = ESX.Math.Round(coords.z, 1)}
RespawnPed(playerPed, formattedCoords, 0.0)
isDead = false
-- ClearTimecycleModifier()
-- SetPedMotionBlur(playerPed, false)
-- ClearExtraTimecycleModifier()
-- EndDeathCam()
DoScreenFadeIn(800)
end)
Last updated