Added ability to find an invisible dead player

https://github.com/ESX-Org/esx_ambulancejob/issues/20
This commit is contained in:
Alex Garcio
2020-02-13 16:44:14 -05:00
parent 783a5eeae2
commit e8e3eaa4d1
11 changed files with 54 additions and 3 deletions
+5 -2
View File
@@ -46,13 +46,16 @@ function OpenMobileAmbulanceActionsMenu()
{label = _U('ems_menu_revive'), value = 'revive'},
{label = _U('ems_menu_small'), value = 'small'},
{label = _U('ems_menu_big'), value = 'big'},
{label = _U('ems_menu_putincar'), value = 'put_in_vehicle'}
{label = _U('ems_menu_putincar'), value = 'put_in_vehicle'},
{label = _U('ems_menu_search'), value = 'search'}
}}, function(data, menu)
if isBusy then return end
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
if closestPlayer == -1 or closestDistance > 1.0 then
if data.current.value == 'search' then
TriggerServerEvent('esx_ambulancejob:svsearch')
elseif closestPlayer == -1 or closestDistance > 1.0 then
ESX.ShowNotification(_U('no_players'))
else
if data.current.value == 'revive' then
+36 -1
View File
@@ -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()
+1
View File
@@ -60,6 +60,7 @@ Locales['br'] = {
['ems_menu_putincar'] = 'colocar no veiculo',
['ems_menu_small'] = 'curar pequenas feridas',
['ems_menu_big'] = 'tratando lesões graves',
['ems_menu_search'] = 'paciente não encontrado',
-- Phone
['alert_ambulance'] = 'alerta socorrista',
-- Death
+1
View File
@@ -60,6 +60,7 @@ Locales['cs'] = {
['ems_menu_putincar'] = 'naložit do vozidla',
['ems_menu_small'] = 'ošetřit malé zranění',
['ems_menu_big'] = 'ošetřit vážné zranění',
['ems_menu_search'] = 'pacient nebyl nalezen',
-- Phone
['alert_ambulance'] = 'zdravotnický poplach',
-- Death
+1
View File
@@ -60,6 +60,7 @@ Locales['en'] = {
['ems_menu_putincar'] = 'put in Vehicle',
['ems_menu_small'] = 'heal small wounds',
['ems_menu_big'] = 'treat serious injuries',
['ems_menu_search'] = 'patient not found',
-- Phone
['alert_ambulance'] = 'alert Ambulance',
-- Death
+1
View File
@@ -60,6 +60,7 @@ Locales['es'] = {
['ems_menu_putincar'] = 'meter en el vehículo',
['ems_menu_small'] = 'heal small wounds',
['ems_menu_big'] = 'treat serious injuries',
['ems_menu_search'] = 'Paciente no encontrado',
-- Phone
['alert_ambulance'] = 'Alerta de ambulancia',
-- Death
+1
View File
@@ -60,6 +60,7 @@ Locales['fi'] = {
['ems_menu_putincar'] = 'Laita ajoneuvoon',
['ems_menu_small'] = 'hoida pieniä haavoja',
['ems_menu_big'] = 'hoida isoja haavoja',
['ems_menu_search'] = 'potilasta ei löydy',
-- Phone
['alert_ambulance'] = 'hälyytys Ensihoidolle',
-- Death
+1
View File
@@ -60,6 +60,7 @@ Locales['fr'] = {
['ems_menu_putincar'] = 'mettre dans véhicule',
['ems_menu_small'] = 'soigner petites blessures',
['ems_menu_big'] = 'soigner blessures graves',
['ems_menu_search'] = 'patient introuvable',
-- Phone
['alert_ambulance'] = 'alerte Ambulance',
-- Death
+1
View File
@@ -60,6 +60,7 @@ Locales['pl'] = {
['ems_menu_putincar'] = 'umieścić w pojeździe',
['ems_menu_small'] = 'ulecz małe rany',
['ems_menu_big'] = 'ulecz poważne obrażenia',
['ems_menu_search'] = 'nie znaleziono pacjenta',
-- Phone
['alert_ambulance'] = 'wezwij ambulans',
-- Death
+1
View File
@@ -60,6 +60,7 @@ Locales['sv'] = {
['ems_menu_putincar'] = 'sätt i fordon',
['ems_menu_small'] = 'behandla mindre skador',
['ems_menu_big'] = 'behandla svåra skador',
['ems_menu_search'] = 'patienten hittades inte',
-- Phone
['alert_ambulance'] = 'ambulanssamtal',
-- Death
+5
View File
@@ -35,6 +35,11 @@ AddEventHandler('esx:onPlayerDeath', function(data)
TriggerClientEvent('esx_ambulancejob:setDeadPlayers', -1, deadPlayers)
end)
RegisterServerEvent('esx_ambulancejob:svsearch')
AddEventHandler('esx_ambulancejob:svsearch', function()
TriggerClientEvent('esx_ambulancejob:clsearch', -1, source)
end)
RegisterNetEvent('esx_ambulancejob:onPlayerDistress')
AddEventHandler('esx_ambulancejob:onPlayerDistress', function()
if deadPlayers[source] then