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
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)