Advertisement
Guest User

Untitled

a guest
May 26th, 2019
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. Citizen.CreateThread(function()
  2. while true do
  3. Wait(0)
  4. -- Controls found in the FiveM docs:
  5. -- https://docs.fivem.net/game-references/controls/
  6.  
  7. if IsControlJustReleased(0, Keys['F5']) then
  8. OpenActionsMenu()
  9. end
  10. if IsControlJustReleased(0, 322) and open or IsControlJustReleased(0, 177) and open then
  11. SendNUIMessage({
  12. action = "close"
  13. })
  14. open = false
  15. end
  16. end
  17. end)
  18.  
  19. function OpenActionsMenu()
  20. ESX.UI.Menu.CloseAll()
  21.  
  22. ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'personal_actions',
  23. {
  24. title = 'Personalien',
  25. align = 'top-left',
  26. elements = {
  27. {label = 'Personalausweis zeigen', value = 'showIDCard'},
  28. {label = 'Waffenschein zeigen', value = 'showWeaponCard'}
  29. }
  30. }, function(data, menu)
  31.  
  32. if data.current.value == 'showIDCard' then
  33. local player, distance = ESX.Game.GetClosestPlayer()
  34.  
  35. if distance ~= -1 and distance <= 3.0 then
  36. TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player))
  37. else
  38. ESX.ShowNotification('Kein Spieler in deiner Nähe!')
  39. end
  40. elseif data.current.value == 'showWeaponCard' then
  41. if distance ~= -1 and distance <= 3.0 then
  42. TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player), 'weapon')
  43. else
  44. ESX.ShowNotification('Kein Spieler in deiner Nähe!')
  45. end
  46. end
  47.  
  48. end, function(data, menu)
  49. menu.close()
  50. end)
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement