ESX
Edit client/main.lua
in esx_ambulancejob
:
Replace this part:
CreateThread(function()
local text, timeHeld
-- early respawn timer
while earlySpawnTimer > 0 and isDead do
Wait(0)
text = TranslateCap('respawn_available_in', secondsToClock(earlySpawnTimer))
DrawGenericTextThisFrame()
BeginTextCommandDisplayText('STRING')
AddTextComponentSubstringPlayerName(text)
EndTextCommandDisplayText(0.5, 0.8)
end
-- bleedout timer
while bleedoutTimer > 0 and isDead do
Wait(0)
text = TranslateCap('respawn_bleedout_in', secondsToClock(bleedoutTimer))
if not Config.EarlyRespawnFine then
text = text .. TranslateCap('respawn_bleedout_prompt')
if IsControlPressed(0, 38) and timeHeld > 120 then
RemoveItemsAfterRPDeath()
break
end
elseif Config.EarlyRespawnFine and canPayFine then
text = text .. TranslateCap('respawn_bleedout_fine', ESX.Math.GroupDigits(Config.EarlyRespawnFineAmount))
if IsControlPressed(0, 38) and timeHeld > 120 then
TriggerServerEvent('esx_ambulancejob:payFine')
RemoveItemsAfterRPDeath()
break
end
end
if IsControlPressed(0, 38) then
timeHeld += 1
else
timeHeld = 0
end
DrawGenericTextThisFrame()
BeginTextCommandDisplayText('STRING')
AddTextComponentSubstringPlayerName(text)
EndTextCommandDisplayText(0.5, 0.8)
end
if bleedoutTimer < 1 and isDead then
RemoveItemsAfterRPDeath()
end
end)
With:
CreateThread(function()
if bleedoutTimer < 1 and isDead then
RemoveItemsAfterRPDeath()
end
end)
And this part:
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
With:
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()
end
Finally, add this code snippet at the end of the file:
AddEventHandler("esx_ambulancejob:RespawnAtHospital", function()
if not Config.EarlyRespawnFine then
RemoveItemsAfterRPDeath()
else
ESX.TriggerServerCallback('esx_ambulancejob:checkBalance', function(canPay)
if canPay then
TriggerServerEvent('esx_ambulancejob:payFine')
RemoveItemsAfterRPDeath()
end
end)
end
end)
Everything is now ready, Please restart your server.
Last updated