[RELEASE][ESX] Persistent Death

in you rtable users, is it “isalife” ?

Nice Stuff, thx!

I’ve the problem, that if I’m dead and rejoin the server I’ve the dead screen but can walk arround…whats wrong?

This is typically due to a skin-related mod. My script kills the default ped and then a skin mod respawns your players ped with their customized ped.

Other than hooking into your skin mod and making my script run after your custom ped loads, the only other option is adding a delay like mentioned above.

thx for that hint! it will help me

Your best bet will be modifying client.lua in the following ways:

Change Line 35-44 from:

AddEventHandler("playerSpawned", function()
	if firstSpawn then
		ESX.TriggerServerCallback('salty_death:isDead', function(isDeadDB)
			if isDeadDB then
				killPlayer()
			end
		end)
		firstSpawn = false
	end
end)

To something like this:

RegisterNetEvent('salty_death:checkStatus')
AddEventHandler('salty_death:checkStatus', function()
	ESX.TriggerServerCallback('salty_death:isDead', function(isDeadDB)
		if isDeadDB then
			killPlayer()
		end
	end)
end)

And then from your clothing script, find where it spawns the new ped and trigger the checkStatus function after your customized ped spawns with:

TriggerEvent('salty_death:checkStatus')

This may give the player who combat logged about 5 seconds after they spawned before they die, but it will still serve the same purpose. I’m using a similar implementation on my server. I have the player set to invisible and they can’t move when they first join the server, and it waits until the new ped model loads and spawns, and then it makes them visible and runs my script.

Just gave that a shot and still doesn’t seem to work after waiting 12 seconds hmm :confused:

TriggerServerCallback => [salty_death:isDead] does not exists

I have this at the arrival of my perso without even being dead.

1 Like

I have no clue what you’re doing, to be honest. The callback is triggered when the player spawns the first time. The error message indicates that your server did not register the callback. The resource appears to be installed incorrectly.

Good job on the script, however the same function has been implemented to esx_ambulancejob, rendering this script useless :smiley:

You’re right, they added anti-combat log in this commit: https://github.com/ESX-Org/esx_ambulancejob/commit/65100a8abd844a0ae0d90152cb1b09f379a5c8ed

That said, the script isn’t useless if you don’t have esx_ambulancejob installed. Not everyone installs every ESX resource. Drives me crazy seeing servers with 100 ESX resources, personally. I did advertise this resource as compatible with esx_ambulancejob because I filled a gap when it was there.

Anywho, I’ll update the OP so people know that if they update their ambulancejob, they can get the combat log protection without an additional resource.

Hello, I have a problem. When somebody die his ped going under textrues. Not everybody but that’s often. Anybody could help me?

My script shouldn’t impact anything about the ped except for it’s health.

Where’s the change?.???

That looks right. You could set the integer length to 1 instead of 11 but :man_shrugging:

my server not record death…Setting in image

Any server error messages?

Im having a problem.
It works if you die and do alt f4 you remain dead but you can walk .with the death timer .

Your skin mod is probably spawning the character after they are killed.

yes, do you know how to fix this ?