From 439927f28afb3473ec4615cf00c0e284296c0b05 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 30 Dec 2018 23:34:24 +0100 Subject: [PATCH] Added respawn to config, very final commit v1.2.0 --- client/main.lua | 15 ++++++++------- config.lua | 2 ++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/client/main.lua b/client/main.lua index 623e73b4..e8dfb2be 100644 --- a/client/main.lua +++ b/client/main.lua @@ -275,11 +275,11 @@ function RemoveItemsAfterRPDeath() end ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function() - ESX.SetPlayerData('lastPosition', Config.Zones.HospitalInteriorInside1.Pos) + ESX.SetPlayerData('lastPosition', Config.RespawnPoint.coords) ESX.SetPlayerData('loadout', {}) - TriggerServerEvent('esx:updateLastPosition', Config.Zones.HospitalInteriorInside1.Pos) - RespawnPed(PlayerPedId(), Config.Zones.HospitalInteriorInside1.Pos) + TriggerServerEvent('esx:updateLastPosition', Config.RespawnPoint.coords) + RespawnPed(PlayerPedId(), Config.RespawnPoint.coords, Config.RespawnPoint.heading) StopScreenEffect('DeathFailOut') DoScreenFadeIn(800) @@ -287,11 +287,11 @@ function RemoveItemsAfterRPDeath() end) end -function RespawnPed(ped, coords) +function RespawnPed(ped, coords, heading) SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true) - NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, coords.heading, true, false) + NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, heading, true, false) SetPlayerInvincible(ped, false) - TriggerEvent('playerSpawned', coords.x, coords.y, coords.z, coords.heading) + TriggerEvent('playerSpawned', coords.x, coords.y, coords.z) ClearPedBloodDamage(ped) ESX.UI.Menu.CloseAll() @@ -340,7 +340,8 @@ AddEventHandler('esx_ambulancejob:revive', function() RespawnPed(playerPed, { x = coords.x, y = coords.y, - z = coords.z + z = coords.z, + heading = 0.0 }) StopScreenEffect('DeathFailOut') diff --git a/config.lua b/config.lua index 59930ec6..db11d078 100644 --- a/config.lua +++ b/config.lua @@ -27,6 +27,8 @@ Config.RemoveItemsAfterRPDeath = true Config.EarlyRespawnFine = false Config.EarlyRespawnFineAmount = 5000 +Config.RespawnPoint = { coords = vector3(341.07, -1397.31, 32.51), heading = 48.5} + Config.Hospitals = { CentralLosSantos = {