mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 08:13:21 +00:00
Added ability to find an invisible dead player
https://github.com/ESX-Org/esx_ambulancejob/issues/20
This commit is contained in:
+36
-1
@@ -1,6 +1,6 @@
|
||||
local firstSpawn, PlayerLoaded = true, false
|
||||
|
||||
isDead = false
|
||||
isDead, isSearched, medic = false, false, 0
|
||||
ESX = nil
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
@@ -81,6 +81,41 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
if isDead and isSearched then
|
||||
local playerPed = PlayerPedId()
|
||||
local ped = GetPlayerPed(GetPlayerFromServerId(medic))
|
||||
isSearched = false
|
||||
|
||||
AttachEntityToEntity(playerPed, ped, 11816, 0.54, 0.54, 0.0, 0.0, 0.0, 0.0, false, false, false, false, 2, true)
|
||||
Citizen.Wait(1000)
|
||||
DetachEntity(playerPed, true, false)
|
||||
ClearPedTasksImmediately(playerPed)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx_ambulancejob:clsearch')
|
||||
AddEventHandler('esx_ambulancejob:clsearch', function(medicId)
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
if isDead then
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
local playersInArea = ESX.Game.GetPlayersInArea(coords, 50.0)
|
||||
|
||||
for i=1, #playersInArea, 1 do
|
||||
local player = playersInArea[i]
|
||||
if player == GetPlayerFromServerId(medicId) then
|
||||
medic = tonumber(medicId)
|
||||
isSearched = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
function OnPlayerDeath()
|
||||
isDead = true
|
||||
ESX.UI.Menu.CloseAll()
|
||||
|
||||
Reference in New Issue
Block a user