From 8b5f2bdf71f7a49f371c1a0eae89b969fe67a0c6 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 25 Apr 2018 21:55:09 +0200 Subject: [PATCH] Check for if player is concious, fixed missing translations --- client/main.lua | 50 ++++++++++++++++++++++++++++++------------------- locales/br.lua | 3 +++ locales/de.lua | 3 +++ locales/en.lua | 3 +++ locales/es.lua | 3 +++ locales/fr.lua | 3 +++ locales/sv.lua | 5 ++++- 7 files changed, 50 insertions(+), 20 deletions(-) diff --git a/client/main.lua b/client/main.lua index a5b82dec..52b3fae2 100644 --- a/client/main.lua +++ b/client/main.lua @@ -339,7 +339,6 @@ function OpenMobileAmbulanceActionsMenu() local health = GetEntityHealth(closestPlayerPed) if health == 0 then - menu.close() local playerPed = GetPlayerPed(-1) ESX.ShowNotification(_U('revive_inprogress')) @@ -372,16 +371,22 @@ function OpenMobileAmbulanceActionsMenu() else ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) if qtty > 0 then - menu.close() - local playerPed = GetPlayerPed(-1) - ESX.ShowNotification(_U('heal_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) + local closestPlayerPed = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(closestPlayerPed) - TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage') - TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'small') - ESX.ShowNotification(_U('heal_complete')) + if health > 0 then + local playerPed = GetPlayerPed(-1) + ESX.ShowNotification(_U('heal_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage') + TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'small') + ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) + else + ESX.ShowNotification(_U('player_not_conscious')) + end else ESX.ShowNotification(_U('not_enough_bandage')) end @@ -395,15 +400,22 @@ function OpenMobileAmbulanceActionsMenu() else ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(qtty) if qtty > 0 then - menu.close() - local playerPed = GetPlayerPed(-1) - ESX.ShowNotification(_U('heal_inprogress')) - TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) - Citizen.Wait(10000) - ClearPedTasks(playerPed) - TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') - TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'big') - ESX.ShowNotification(_U('heal_complete')) + local closestPlayerPed = GetPlayerPed(closestPlayer) + local health = GetEntityHealth(closestPlayerPed) + + if health > 0 then + local playerPed = GetPlayerPed(-1) + ESX.ShowNotification(_U('heal_inprogress')) + TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) + Citizen.Wait(10000) + ClearPedTasks(playerPed) + + TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit') + TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'big') + ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer))) + else + ESX.ShowNotification(_U('player_not_conscious')) + end else ESX.ShowNotification(_U('not_enough_medikit')) end diff --git a/locales/br.lua b/locales/br.lua index cb23085f..3658c8f5 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -14,9 +14,12 @@ Locales['br'] = { ['revive_inprogress'] = 'Reanimação em andamento', ['revive_complete'] = 'você ressuscitou ~y~%s~s~', ['revive_complete_award'] = 'você ressuscitou ~y~%s~s~, ~g~$%s~s~', + ['heal_inprogress'] = 'you are healing!', + ['heal_complete'] = 'you have healed ~y~%s~s~', ['no_players'] = 'Nenhum jogador nas proximidades', ['no_vehicles'] = 'Sem veículos nas proximidades', ['player_not_unconscious'] = 'Não está inconsciente', + ['player_not_conscious'] = 'that player is not conscious!', -- Boss Menu ['deposit_society'] = 'Depositar dinheiro', ['withdraw_society'] = 'Retirar dinheiro da empresa', diff --git a/locales/de.lua b/locales/de.lua index 6b964884..125998c2 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -14,9 +14,12 @@ Locales['de'] = { ['revive_inprogress'] = 'wiederbeleben im Gange', ['revive_complete'] = 'du wurdest wiederbelebt ~y~%s~s~', ['revive_complete_award'] = 'du wurdest wiederbelebt ~y~%s~s~, ~g~$%s~s~', + ['heal_inprogress'] = 'you are healing!', + ['heal_complete'] = 'you have healed ~y~%s~s~', ['no_players'] = 'keine Spieler in der Nähe', ['no_vehicles'] = 'keine Fahrzeuge in der Nähe', ['player_not_unconscious'] = 'ist nicht im Koma', + ['player_not_conscious'] = 'that player is not conscious!', -- Boss Menu ['deposit_society'] = 'Notdienst einzahlen', ['withdraw_society'] = 'Notdienst abheben', diff --git a/locales/en.lua b/locales/en.lua index fb5c005d..db01877c 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -14,9 +14,12 @@ Locales['en'] = { ['revive_inprogress'] = 'a revive is in progress!', ['revive_complete'] = 'you have revived ~y~%s~s~', ['revive_complete_award'] = 'you have revived ~y~%s~s~ and earned ~g~$%s~s~!', + ['heal_inprogress'] = 'you are healing!', + ['heal_complete'] = 'you have healed ~y~%s~s~', ['no_players'] = 'no players nearby', ['no_vehicles'] = 'no vehicles nearby', ['player_not_unconscious'] = 'that player is not unconscious!', + ['player_not_conscious'] = 'that player is not conscious!', -- Boss Menu ['deposit_society'] = 'eMS Deposit', ['withdraw_society'] = 'eMS Withdraw', diff --git a/locales/es.lua b/locales/es.lua index 371c77d8..185b1740 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -14,9 +14,12 @@ Locales['es'] = { ['revive_inprogress'] = 'reanimación en curso', ['revive_complete'] = 'has sido reanimado ~y~%s~s~', ['revive_complete_award'] = 'has sido reanimado ~y~%s~s~, ~g~$%s~s~', + ['heal_inprogress'] = 'you are healing!', + ['heal_complete'] = 'you have healed ~y~%s~s~', ['no_players'] = 'ningún jugador cerca', ['no_vehicles'] = 'ningún vehículo cerca', ['player_not_unconscious'] = 'n\'estás inconsciente', + ['player_not_conscious'] = 'that player is not conscious!', -- oss Menu ['deposit_society'] = 'depositar dinero', ['withdraw_society'] = 'retirar dinero', diff --git a/locales/fr.lua b/locales/fr.lua index 0a60983c..5ac27c7d 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -14,9 +14,12 @@ Locales['fr'] = { ['revive_inprogress'] = 'réanimation en cours', ['revive_complete'] = 'vous avez réanimé ~y~%s~s~', ['revive_complete_award'] = 'vous avez réanimé ~y~%s~s~, ~g~$%s~s~', + ['heal_inprogress'] = 'you are healing!', + ['heal_complete'] = 'you have healed ~y~%s~s~', ['no_players'] = 'aucun joueur à proximité', ['no_vehicles'] = 'aucun véhicule à proximité', ['player_not_unconscious'] = 'n\'est pas inconscient', + ['player_not_conscious'] = 'that player is not conscious!', -- Boss Menu ['deposit_society'] = 'déposer argent', ['withdraw_society'] = 'retirer argent société', diff --git a/locales/sv.lua b/locales/sv.lua index 578928f8..20a05630 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -14,9 +14,12 @@ Locales['sv'] = { ['revive_inprogress'] = 'Återupplivning pågår...', ['revive_complete'] = 'du har återupplivat ~y~%s~s~, bra jobbat!', ['revive_complete_award'] = 'du har återupplivat ~y~%s~s~ och tjärnat ~g~$%s~s~ i processen, bra jobbat!', + ['heal_inprogress'] = 'du behandlar patienten!', + ['heal_complete'] = 'du har behandlat ~y~%s~s~', ['no_players'] = 'Inga spelare i närheten!', ['no_vehicles'] = 'Inga fordon i närheten!', ['player_not_unconscious'] = 'spelaren är inte medvetslös!', + ['player_not_conscious'] = 'spelaren är inte vid medvetande!', -- Boss Menu ['deposit_society'] = 'Sjukvårdens insättning', ['withdraw_society'] = 'Sjukvårdens uttagning', @@ -55,6 +58,6 @@ Locales['sv'] = { ['used_bandage'] = 'Du har använt ~y~1x~s~ ~b~Bandage~s~', ['not_enough_medikit'] = 'Du har inget ~b~Medecinkit~w~.', ['not_enough_bandage'] = 'Du har inget ~b~Bandage~w~.', - ['healed'] = 'Du har blivit återupplivad.', + ['healed'] = 'dina skador har blivit behandlade.', -- Misc }