Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function OpenMobileAmbulanceActionsMenu()
- ESX.UI.Menu.CloseAll()
- ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_ambulance_actions', {
- title = _U('ambulance'),
- align = 'top-left',
- elements = {
- {label = _U('ems_menu'), value = 'citizen_interaction'},
- {label = ('Krankentrage Steuerung'), value = "stretcher"}
- }}, function(data, menu)
- if data.current.value == 'citizen_interaction' then
- ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'citizen_interaction', {
- title = _U('ems_menu_title'),
- align = 'top-left',
- elements = {
- {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_search'), value = 'search'}
- }}, function(data, menu)
- if isBusy then return end
- local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
- if data.current.value == 'search' then
- TriggerServerEvent('esx_ambulancejob:svsearch')
- elseif closestPlayer == -1 or closestDistance > 1.0 then
- --ESX.ShowNotification(_U('no_players'))
- exports['okokNotify']:Alert("Johanniter", "Es ist niemand in der Nähe", 5000, 'info')
- else
- if data.current.value == 'revive' then
- revivePlayer(closestPlayer)
- elseif data.current.value == 'small' then
- ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity)
- if quantity > 0 then
- local closestPlayerPed = GetPlayerPed(closestPlayer)
- local health = GetEntityHealth(closestPlayerPed)
- if health > 0 then
- local playerPed = PlayerPedId()
- isBusy = true
- --ESX.ShowNotification(_U('heal_inprogress'))
- exports['okokNotify']:Alert("Johanniter", "Du behandelst den Patienten", 5000, 'info')
- TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true)
- Wait(10000)
- ClearPedTasks(playerPed)
- TriggerServerEvent('esx_ambulancejob:removeItem', 'bandage')
- TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'small')
- --ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer)))
- exports['okokNotify']:Alert("Johanniter", "Du hast den Patienten versorgt", 5000, 'success')
- isBusy = false
- else
- --ESX.ShowNotification(_U('player_not_conscious'))
- exports['okokNotify']:Alert("Johanniter", "Die Person ist nicht bei bewusstsein!", 5000, 'error')
- end
- else
- --ESX.ShowNotification(_U('not_enough_bandage'))
- exports['okokNotify']:Alert("Johanniter", "Du hast keinen Verband dabei!", 5000, 'info')
- end
- end, 'bandage')
- elseif data.current.value == 'big' then
- ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity)
- if quantity > 0 then
- local closestPlayerPed = GetPlayerPed(closestPlayer)
- local health = GetEntityHealth(closestPlayerPed)
- if health > 0 then
- local playerPed = PlayerPedId()
- isBusy = true
- --ESX.ShowNotification(_U('heal_inprogress'))
- exports['okokNotify']:Alert("Johanniter", "Du behandelst den Patienten", 5000, 'info')
- TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true)
- Wait(10000)
- ClearPedTasks(playerPed)
- TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit')
- TriggerServerEvent('esx_ambulancejob:heal', GetPlayerServerId(closestPlayer), 'big')
- --ESX.ShowNotification(_U('heal_complete', GetPlayerName(closestPlayer)))
- exports['okokNotify']:Alert("Johanniter", "Du hast den Patienten versorgt", 5000, 'success')
- isBusy = false
- else
- --ESX.ShowNotification(_U('player_not_conscious'))
- exports['okokNotify']:Alert("Johanniter", "Die Person ist nicht bei bewusstsein!", 5000, 'error')
- end
- else
- --ESX.ShowNotification(_U('not_enough_medikit'))
- exports['okokNotify']:Alert("Johanniter", "Du hast keinen Erste-Hilfe-Koffer dabei!", 5000, 'info')
- end
- end, 'medikit')
- elseif data.current.value == 'put_in_vehicle' then
- TriggerServerEvent('esx_ambulancejob:putInVehicle', GetPlayerServerId(closestPlayer))
- end
- end
- end, function(data, menu)
- menu.close()
- end)
- end
- end, function(data, menu)
- menu.close()
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement