Hello guys,
My question is, how to make or which file i sould edit to make the respawn after death on specific location?
i know in config.lua you can change the coords but in main.lua there is no mention of “RespawnPoint” but i still reappear at the same place where I died and not at the coords in the config.lua
Config.RespawnPoint = { coords = vector3(365.96, -582.55, 43.28), heading = 140.0 }
I already check all type of topics but at every topic i found different information which is old or not usable.
Hey @Prostate.Divine
Do you want to change the coordinates? If so, simply [Config.RespawnPoint = { coords = vector3(365.96, -582.55, 43.28), heading = 140.0 }], change the highlighted area according to the wishes of your coord.
1 Like
Yes I forgot to mention that I reappear at the place where I died and not at the coords in the config.lua
Search times for the ** function RemoveItemsAfterRPDeath () ** in the client Lua and compare it with mine then it should work. If you die with me you spawn in the MD after you die
function RemoveItemsAfterRPDeath()
TriggerServerEvent('esx_ambulancejob:setDeathStatus', false)
Citizen.CreateThread(function()
DoScreenFadeOut(800)
while not IsScreenFadedOut() do
Citizen.Wait(10)
end
ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function()
local formattedCoords = {
x = Config.RespawnPoint.coords.x,
y = Config.RespawnPoint.coords.y,
z = Config.RespawnPoint.coords.z
}
ESX.SetPlayerData('lastPosition', formattedCoords)
ESX.SetPlayerData('loadout', {})
TriggerServerEvent('esx:updateLastPosition', formattedCoords)
RespawnPed(PlayerPedId(), formattedCoords, Config.RespawnPoint.heading)
StopScreenEffect('DeathFailOut')
DoScreenFadeIn(800)
end)
end)
end
1 Like
ok I will see
here is mine :
function RemoveItemsAfterRPDeath()
--Nombreinter = Nombreinter - 1
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
TriggerServerEvent('esx_ambulancejob:setDeathStatus', false)
Citizen.CreateThread(function()
DoScreenFadeOut(800)
while not IsScreenFadedOut() do
Citizen.Wait(10)
end
local formattedCoords = {
x = ESX.Math.Round(coords.x, 1),
y = ESX.Math.Round(coords.y, 1),
z = ESX.Math.Round(coords.z, 1)
}
ESX.SetPlayerData('lastPosition', formattedCoords)
TriggerServerEvent('esx:updateLastPosition', formattedCoords)
RespawnPed(playerPed, formattedCoords, 0.0)
StopScreenEffect('DeathFailOut')
DoScreenFadeIn(800)
Citizen.Wait(10)
ClearPedTasksImmediately(playerPed)
SetTimecycleModifier("spectator5") -- Je sait pas se que ça fait lel
SetPedMotionBlur(playerPed, true)
RequestAnimSet("move_injured_generic")
while not HasAnimSetLoaded("move_injured_generic") do
Citizen.Wait(0)
end
SetPedMovementClipset(playerPed, "move_injured_generic", true)
PlaySoundFrontend(-1, "1st_Person_Transition", "PLAYER_SWITCH_CUSTOM_SOUNDSET", 0)
PlaySoundFrontend(-1, "1st_Person_Transition", "PLAYER_SWITCH_CUSTOM_SOUNDSET", 0)
ESX.ShowAdvancedNotification('REANIMATION X', 'Unité X réanimation', 'Vous avez été réanimé par l\'unité X.', 'CHAR_CALL911', 1)
local ped = GetPlayerPed(PlayerId())
local coords = GetEntityCoords(ped, false)
local name = GetPlayerName(PlayerId())
local x, y, z = table.unpack(GetEntityCoords(ped, false))
TriggerServerEvent('esx_ambulance:NotificationBlipsX', x, y, z, name)
Citizen.Wait(60*1000) -- Effets de la réanmation pendant 1 minute ( 60 seconde )
Normal()
end)
end
EDIT: @Vitaminkeks Ok thanks for you help bro you are the best 
No problem
have a nice day
How can I make sure that you do not spawn exactly at the death point but nearby?
Do you mean that a person should spawn near a coordinate after ingame death?
Ahhh so if someone bleeds out ingame then he should spawn on the old position ?
I myself don’t know how to do it right away.
function RemoveItemsAfterRPDeath()
--Nombreinter = Nombreinter - 1
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
TriggerServerEvent('esx_ambulancejob:setDeathStatus', false)
Citizen.CreateThread(function()
DoScreenFadeOut(800)
while not IsScreenFadedOut() do
Citizen.Wait(10)
end
local radius = 100
local formattedCoords = {
x = ESX.Math.Round((coords.x + math.random(-radius, radius)), 1),
y = ESX.Math.Round((coords.y + math.random(-radius, radius)), 1),
z = ESX.Math.Round(coords.z + 1000, 1)
}
ESX.SetPlayerData('lastPosition', formattedCoords)
TriggerServerEvent('esx:updateLastPosition', formattedCoords)
RespawnPed(playerPed, formattedCoords, 0.0)
StopScreenEffect('DeathFailOut')
DoScreenFadeIn(800)
Citizen.Wait(10)
ClearPedTasksImmediately(playerPed)
local newcoords = GetEntityCoords(playerPed)
local newcoords = {
x = ESX.Math.Round(newcoords.x, 1),
y = ESX.Math.Round(newcoords.y, 1),
z = ESX.Math.Round(newcoords.z - GetEntityHeightAboveGround(playerPed), 1)
}
ESX.Game.Teleport(playerPed, newcoords, cb)
RequestAnimSet("move_injured_generic")
while not HasAnimSetLoaded("move_injured_generic") do
Citizen.Wait(0)
end
local ped = GetPlayerPed(PlayerId())
local coords = GetEntityCoords(ped, false)
local name = GetPlayerName(PlayerId())
local x, y, z = table.unpack(GetEntityCoords(ped, false))
TriggerServerEvent('esx_ambulance:NotificationBlipsX', x, y, z, name)
Citizen.Wait(5*1) -- Effets de la réanmation pendant 1 minute ( 60 seconde )
Normal()
end)
end