QBCore
Disabling the QBCore Ambulance Job Default Death Screen
To remove or disable the death screen in the QBCore Ambulance Job, make adjustments to certain functions in client/dead.lua
. The following instructions guide you through commenting out lines responsible for the visual effects and camera controls associated with the death screen.
It is not recommended to use the Death Animation from Cloud Deathscreen if you're using QBCore. Instead, use the death animation provided by qb-ambulancejob.
Step 1: Modify gameEventTriggered
Event
gameEventTriggered
EventLocate the gameEventTriggered
event handler and comment out the lines related to the death screen timer.
Original Code:
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)
Updated Code:
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)
Step 2: Modify Main Thread
Locate the thread below and comment out the lines related to the death screen timer.
Original Code:
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
...
...
...
...
...
...
Updated Code:
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
...
...
...
...
...
...
Last updated