From 11356de23e41ea74ed71200dfffa9e7774efcd0c Mon Sep 17 00:00:00 2001 From: Henric Backman Date: Tue, 12 May 2020 09:57:59 +0200 Subject: [PATCH] Update readme.md --- readme.md | 59 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/readme.md b/readme.md index a00b43eb..ef9e0b7e 100644 --- a/readme.md +++ b/readme.md @@ -241,24 +241,26 @@ comment or delete * esx_ambulancejob: (`esx_ambulancejob/client/main.lua`) ### find: ```lua -AddEventHandler('playerSpawned', function() - IsDead = false +AddEventHandler('esx:onPlayerSpawn', function() + isDead = false - if FirstSpawn then - exports.spawnmanager:setAutoSpawn(false) -- disable respawn - FirstSpawn = false + if firstSpawn then + exports.spawnmanager:setAutoSpawn(false) + firstSpawn = false - ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(isDead) - if isDead and Config.AntiCombatLog then - while not PlayerLoaded do - Citizen.Wait(1000) - end + if Config.AntiCombatLog then + while not PlayerLoaded do + Citizen.Wait(1000) + end - ESX.ShowNotification(_U('combatlog_message')) - RemoveItemsAfterRPDeath() - end - end) - end + ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(shouldDie) + if shouldDie then + ESX.ShowNotification(_U('combatlog_message')) + RemoveItemsAfterRPDeath() + end + end) + end + end end) ``` @@ -266,18 +268,21 @@ end) ```lua RegisterNetEvent('esx_ambulancejob:multicharacter') AddEventHandler('esx_ambulancejob:multicharacter', function() - IsDead = false - if Config.AntiCombatLog then - while not PlayerLoaded do - Citizen.Wait(1000) - end - ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(isDead) - if isDead and Config.AntiCombatLog then - ESX.ShowNotification(_U('combatlog_message')) - RemoveItemsAfterRPDeath() - end - end) - end + IsDead = false + if firstSpawn then + firstSpawn = false + if Config.AntiCombatLog then + while not PlayerLoaded do + Citizen.Wait(1000) + end + ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(isDead) + if isDead and Config.AntiCombatLog then + ESX.ShowNotification(_U('combatlog_message')) + RemoveItemsAfterRPDeath() + end + end) + end + end end) ```