Advertisement
CompCrafter

Untitled

Mar 25th, 2023
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.54 KB | None | 0 0
  1. function OpenMobileAmbulanceActionsMenu()
  2. ESX.UI.Menu.CloseAll()
  3.  
  4. ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_ambulance_actions', {
  5. title = _U('ambulance'),
  6. align = 'top-left',
  7. elements = {
  8. {label = _U('ems_menu'), value = 'citizen_interaction'},
  9. {label = ('Krankentrage Steuerung'), value = "stretcher"}
  10. }}, function(data, menu)
  11. if data.current.value == 'citizen_interaction' then
  12. ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'citizen_interaction', {
  13. title = _U('ems_menu_title'),
  14. align = 'top-left',
  15. elements = {
  16. {label = _U('ems_menu_revive'), value = 'revive'},
  17. {label = _U('ems_menu_small'), value = 'small'},
  18. {label = _U('ems_menu_big'), value = 'big'},
  19. {label = _U('ems_menu_putincar'), value = 'put_in_vehicle'},
  20. {label = _U('ems_menu_search'), value = 'search'}
  21. }}, function(data, menu)
  22.  
  23. if isBusy then return end
  24.  
  25. local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
  26.  
  27. if data.current.value == 'search' then
  28. TriggerServerEvent('esx_ambulancejob:svsearch')
  29. elseif closestPlayer == -1 or closestDistance > 1.0 then
  30. --ESX.ShowNotification(_U('no_players'))
  31. exports['okokNotify']:Alert("Johanniter", "Es ist niemand in der Nähe", 5000, 'info')
  32. else
  33. if data.current.value == 'revive' then
  34. revivePlayer(closestPlayer)
  35. elseif data.current.value == 'small' then
  36. ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity)
  37. if quantity > 0 then
  38. local closestPlayerPed = GetPlayerPed(closestPlayer)
  39. local health = GetEntityHealth(closestPlayerPed)
  40.  
  41. if health > 0 then
  42. local playerPed = PlayerPedId()
  43.  
  44. isBusy = true
  45. --ESX.ShowNotification(_U('heal_inprogress'))
  46. exports['okokNotify']:Alert("Johanniter", "Du behandelst den Patienten", 5000, 'info')
  47. TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true)
  48. Wait(10000)
  49. ClearPedTasks(playerPed)
  50.  
  51. TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage')
  52. TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'small')
  53. --ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer)))
  54. exports['okokNotify']:Alert("Johanniter", "Du hast den Patienten versorgt", 5000, 'success')
  55. isBusy = false
  56. else
  57. --ESX.ShowNotification(_U('player_not_conscious'))
  58. exports['okokNotify']:Alert("Johanniter", "Die Person ist nicht bei bewusstsein!", 5000, 'error')
  59. end
  60. else
  61. --ESX.ShowNotification(_U('not_enough_bandage'))
  62. exports['okokNotify']:Alert("Johanniter", "Du hast keinen Verband dabei!", 5000, 'info')
  63. end
  64. end, 'bandage')
  65.  
  66. elseif data.current.value == 'big' then
  67.  
  68. ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity)
  69. if quantity > 0 then
  70. local closestPlayerPed = GetPlayerPed(closestPlayer)
  71. local health = GetEntityHealth(closestPlayerPed)
  72.  
  73. if health > 0 then
  74. local playerPed = PlayerPedId()
  75.  
  76. isBusy = true
  77. --ESX.ShowNotification(_U('heal_inprogress'))
  78. exports['okokNotify']:Alert("Johanniter", "Du behandelst den Patienten", 5000, 'info')
  79. TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true)
  80. Wait(10000)
  81. ClearPedTasks(playerPed)
  82.  
  83. TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit')
  84. TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'big')
  85. --ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer)))
  86. exports['okokNotify']:Alert("Johanniter", "Du hast den Patienten versorgt", 5000, 'success')
  87. isBusy = false
  88. else
  89. --ESX.ShowNotification(_U('player_not_conscious'))
  90. exports['okokNotify']:Alert("Johanniter", "Die Person ist nicht bei bewusstsein!", 5000, 'error')
  91. end
  92. else
  93. --ESX.ShowNotification(_U('not_enough_medikit'))
  94. exports['okokNotify']:Alert("Johanniter", "Du hast keinen Erste-Hilfe-Koffer dabei!", 5000, 'info')
  95. end
  96. end, 'medikit')
  97.  
  98. elseif data.current.value == 'put_in_vehicle' then
  99. TriggerServerEvent('esx_ambulancejob:putInVehicle', GetPlayerServerId(closestPlayer))
  100. end
  101. end
  102. end, function(data, menu)
  103. menu.close()
  104. end)
  105. end
  106.  
  107. end, function(data, menu)
  108. menu.close()
  109. end)
  110. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement