QB Ambulancejob
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.
General Installation Guide
Remove Death Timer
Search for the gameEventTriggered
handler in client/dead.lua
and comment out the DeathTimer()
function call
qb-ambulancejob/client/dead.lua
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)
Remove Native Death Screen
Locate the main thread and comment out the following lines:
qb-ambulancejob/client/dead.lua
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)
Support
Need help? Our support team is always ready to assist
Join DiscordESX Ambulancejob
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.
Wasabi Ambulance
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.