From 2da17bc123378100147803906bc4e805c610dab4 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 24 Mar 2020 10:33:56 +0100 Subject: [PATCH] Support latest esx --- client/main.lua | 9 ++++----- server/main.lua | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/client/main.lua b/client/main.lua index 2298cbb1..3596a306 100644 --- a/client/main.lua +++ b/client/main.lua @@ -28,12 +28,10 @@ AddEventHandler('esx:setJob', function(job) ESX.PlayerData.job = job end) -AddEventHandler('playerSpawned', function() +AddEventHandler('esx:onPlayerSpawn', function() isDead = false - TriggerServerEvent('esx_ambulancejob:onPlayerSpawn') if firstSpawn then - exports.spawnmanager:setAutoSpawn(false) -- disable respawn firstSpawn = false if Config.AntiCombatLog then @@ -310,10 +308,11 @@ function RespawnPed(ped, coords, heading) SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true) NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, heading, true, false) SetPlayerInvincible(ped, false) - TriggerEvent('playerSpawned', coords.x, coords.y, coords.z) ClearPedBloodDamage(ped) - ESX.UI.Menu.CloseAll() + TriggerServerEvent('esx:onPlayerSpawn') + TriggerEvent('esx:onPlayerSpawn') + TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon end RegisterNetEvent('esx_phone:loaded') diff --git a/server/main.lua b/server/main.lua index 57fed8ae..664d7457 100644 --- a/server/main.lua +++ b/server/main.lua @@ -43,8 +43,8 @@ AddEventHandler('esx_ambulancejob:onPlayerDistress', function() end end) -RegisterNetEvent('esx_ambulancejob:onPlayerSpawn') -AddEventHandler('esx_ambulancejob:onPlayerSpawn', function() +RegisterNetEvent('esx:onPlayerSpawn') +AddEventHandler('esx:onPlayerSpawn', function() if deadPlayers[source] then deadPlayers[source] = nil TriggerClientEvent('esx_ambulancejob:setDeadPlayers', -1, deadPlayers)