[HELP] How to use Set Death Player from ambulance job (Combat Log)

Hi Guys

where of ambulance job script can i find set player to death true ?

u know , i want this :

If player was in battle and if Disconnect from server OR Close Fivem(alt+f4) then set player death = true

something like this :

RegisterNetEvent('PLAYER:ALTF4')
AddEventHandler('PLAYER:ALTF4', function()
    if not ESX.GetPlayerData().IsDead then
        InJure = true
        ESX.SetPlayerData('IsDead', true)
    end
    TriggerServerEvent('esx_ambulancejob:setDaathStatus', deathCause)
end)

that code is not working !
can anyone please help me ? tnx

SOLVED

RegisterServerEvent('LEFT4:DEAD')
AddEventHandler('LEFT4:DEAD', function(isDead)
	local xPlayer = ESX.GetPlayerFromId(source)
	if xPlayer ~= nil then
		if isDead ~= -1 then
			xPlayer.set('IsDead', isDead)
			xPlayer.set('Injure', isDead)

			if type(isDead) ~= 'boolean' then
				isDead = true
			end

			MySQL.Sync.execute('UPDATE users SET is_dead = @isDead WHERE identifier = @identifier', {
				['@identifier'] = xPlayer.identifier,
				['@isDead'] = isDead
			})
		else
			xPlayer.set('Injure', 'done')
		end
	end
	print('TEST2')
end)

Combat log is already a feature from ambulance Job check the config to make sure it’s on

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.