[HELP] EMS cant found player who died

Hello guys, anyone can solve about player cant found by ems?
i am wondering a feature that has Keybind like press G to send signal, but it is Press H when EMS cant find your body, so the body player when he press H, their body will noclip for a while moment and back die

If you guys have a script or something else where can solve this problem, please give or help me
Thanks Guys

2 Likes

hope this helps
you know who i am :grinning:

--add it
EnableControlAction(0, Keys['H'], true)



--clear pedtask **looping every 30second** 
--then change

function OnPlayerDeath()
	IsDead = true
	TriggerServerEvent('esx_ambulancejob:setDeathStatus', true)
	 
	StartDeathTimer()
	StartDistressSignal()
	
	StartScreenEffect('DeathFailOut', 0, false) 
	ClearPedTasksImmediately(GetPlayerPed(-1))
	 
	repeat
	Citizen.Wait(30000)
	ClearPedTasksImmediately(GetPlayerPed(-1))
	until IsDead == false
	
end


--press [H] for manual clearpedtask
function StartDistressSignal()
	Citizen.CreateThread(function()
		local timer = Config.BleedoutTimer

		while timer > 0 and IsDead do
			Citizen.Wait(2)
			timer = timer - 30

			SetTextFont(4)
			SetTextScale(0.45, 0.45)
			SetTextColour(185, 185, 185, 255)
			SetTextDropshadow(0, 0, 0, 0, 255)
			SetTextEdge(1, 0, 0, 0, 255)
			SetTextDropShadow()
			SetTextOutline()
			BeginTextCommandDisplayText('STRING')
			AddTextComponentSubstringPlayerName(_U('distress_send'))
			EndTextCommandDisplayText(0.175, 0.805)

			if IsControlPressed(0, Keys['G']) then
				SendDistressSignal()

				Citizen.CreateThread(function()
					Citizen.Wait(60000)
					if IsDead then
						StartDistressSignal()
					end
				end)

				break
			end

			if IsControlPressed(0, Keys['H']) then
				ClearPedTasksImmediately(GetPlayerPed(-1))

				Citizen.CreateThread(function()
					Citizen.Wait(10000)
					if IsDead then
						StartDistressSignal()
					end
				end)

				break
			end
			
		end
	end)
end
7 Likes

the above code will help…as it causing your player to clear tasks… and then fall down dead again. Which will cause the player to ragdoll all over the place. You can either put in a catch - to make them raddoll in the same spot by setting entity pos right before they ragdoll - or look into setting player in death state while they are still alive, which is how most servers do it these days… so on player death… set IsDead = true resurrect player and set health to 100, and make it play death animation in a loop until he/she is revived.

SpikE

3 Likes

thanks mate!!!

where i put this?

1 Like

Where I Should Put This Script?

Where I Should Put This Script?Can You Make The Tutorial?

1 Like

put into client ambulancejob, search ```
function OnPlayerDeath()

and to end put

LATE ----> StartScreenEffect(‘DeathFailOut’, 0, false)
this down paste
ClearPedTasksImmediately(GetPlayerPed(-1))

repeat
Citizen.Wait(30000)
ClearPedTasksImmediately(GetPlayerPed(-1))
until IsDead == false

end

and when dead there is reload player every timer (30 sec, put at 240000 for 4 minut )

Doesn’t work

do you know where

its working
I want to add key to refresh dead body [ eg: G or H ]

Do you have an example on how to do “set IsDead = true resurrect player and set health to 100, and make it play death animation in a loop until he/she is revived”?

can the refreshing body key h can also set to g.like when we press g distress signal and refresh should happen like that.

Bro how to set this to a key

Bro u added?

you can easily add buttons for this with if’s that should work:

	if IsControlPressed(0,key) and isDead == true then
		ClearPedTasksImmediately(GetPlayerPed(-1))
			repeat
				Citizen.Wait(30000)
				ClearPedTasksImmediately(GetPlayerPed(-1))
until IsDead == false

fivem controls ( keys )

Where to put this line bro?

That’s some nice code and it’s working but for some reason
until isDead == false is not working. It’s just clearing the ped and don’t let them drive in cars becouse they get reset.

1 Like

Hi folks, I would like to ask if anyone knows, if there is a dead Person they can’t send a distress signal?
Im searching for some time and well i didnt really found anything

Exactly about esx_ambulancejob a slightly old version ‘1.2.0’.
Thanks in advance.

-- Disable most inputs when dead
Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)

		if IsDead then
			DisableAllControlActions(0)
			EnableControlAction(0, 47, true)
			EnableControlAction(0, 245, true)
			EnableControlAction(0, 38, true)
		else
			Citizen.Wait(500)
		end
	end
end)

function OnPlayerDeath()

--if GetPlayerRoutingBucket(source) ~= 5 then
	IsDead = true
	local second = 1000

	Citizen.CreateThread(function()
		repeat
			Citizen.Wait(300 * second)
			ClearPedTasksImmediately(GetPlayerPed(-1))
		until IsDead == false
	end)
		
	ESX.UI.Menu.CloseAll()
	TriggerServerEvent('esx_ambulancejob:setDeathStatus', true)

	StartDeathTimer()
	--SendDistressSignal()

	ClearPedTasksImmediately(GetPlayerPed(-1))
	StartScreenEffect('DeathFailOut', 0, false)
--end
end

function StartDistressSignal()
	Citizen.CreateThread(function()
		local timer = Config.EarlyRespawnTimer

		while timer > 0 and IsDead do
				Citizen.Wait(2)
				timer = timer - 30

			SetTextFont(4)
			SetTextScale(0.0, 0.5)
			SetTextColour(255, 255, 255, 255)
			SetTextDropshadow(0, 0, 0, 0, 255)
			SetTextEdge(1, 0, 0, 0, 255)
			SetTextDropShadow()
			SetTextOutline()
			SetTextCentre(true)
			BeginTextCommandDisplayText('STRING')
			AddTextComponentSubstringPlayerName(_U('distress_send'))
			EndTextCommandDisplayText(0.175, 0.805)

			if IsControlPressed(1, Keys['E']) then
				SendDistressSignal()
				
				Citizen.CreateThread(function()
					Citizen.Wait(60000)
					if IsDead then
						StartDistressSignal()
					end
				end)

				break
			end
		end
	end)
end

function SendDistressSignal()
	local playerPed = PlayerPedId()
	local coords    = GetEntityCoords(playerPed)
	local position = {x = coords.x, y = coords.y, z = coords.z}


	TriggerEvent("d-phone:client:message:senddispatch", "Verletzte Person entdeckt!", "ambulance", 0, 1, position, "5")
	TriggerEvent("d-notification", "Dein Notruf wurde abgesetzt", 5000,  "rgba(255, 0, 0, 0.8)")
end

function DrawGenericTextThisFrame()
	SetTextFont(4)
	SetTextScale(0.0, 0.5)
	SetTextColour(255, 255, 255, 255)
	SetTextDropshadow(0, 0, 0, 0, 255)
	SetTextEdge(1, 0, 0, 0, 255)
	SetTextDropShadow()
	SetTextOutline()
	SetTextCentre(true)
end