Drag codem-deathscreen into your resources folder.
Select the framework you're using options are newqb, esx, oldqb from config.
Paste this code to esx_ambulancejob/client/main.lua as well.
Delete the codes from esx_ambulancejob/client/main.lua shown below.
Find the event from esx_ambulancejob/client/main.lua shown below.
And than add the following code to below the event.
Step 6 - Edit Server Main Lua
Find the events shown below.
And than paste the code to required places.
Add the codes down below to shown place up there.
Also add it to there as well.
And add this code as well.
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)
TriggerServerEvent('qb-playerDied')
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[weapon].label or 'Unknown'
local weaponName = 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()
TriggerServerEvent('qb-playerDied',weaponLabel)
end
end
end
end)
Find the codes shown below.
And replace it with this codes.
emsNotified = false
CreateThread(function()
while true do
local sleep = 1000
if isDead or InLaststand then
sleep = 5
local ped = PlayerPedId()
-- 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 > Laststand.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)
If you want to do something different when you press the give up button you can change it from the codes shown below.
If you want to do something different when you press the wait doctor button you can change it from the codes shown below.