Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.85 KB | None | 0 0
  1. local Keys = {
  2.     ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
  3.     ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
  4.     ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
  5.     ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
  6.     ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
  7.     ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
  8.     ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
  9.     ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
  10.     ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
  11.   }
  12.  
  13.   ESX              = nil
  14.   local PlayerData = {}
  15.  
  16.   Citizen.CreateThread(function()
  17.       while ESX == nil do
  18.           TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
  19.           Citizen.Wait(0)
  20.       end
  21.   end)
  22.  
  23.   RegisterNetEvent('esx:playerLoaded')
  24.   AddEventHandler('esx:playerLoaded', function(xPlayer)
  25.     PlayerData = xPlayer  
  26.   end)
  27.  
  28.   RegisterNetEvent('esx:setJob')
  29.   AddEventHandler('esx:setJob', function(job)
  30.     PlayerData.job = job
  31.   end)
  32.  
  33.   function openMenu()
  34.     ESX.UI.Menu.Open(
  35.       'default', GetCurrentResourceName(), 'id_card_menu',
  36.       {
  37.           title    = 'ID menu',
  38.           elements = {
  39.               {label = 'Vê o teu CC', value = 'checkID'},
  40.               {label = 'Mostra o teu CC', value = 'showID'},
  41.               {label = 'Vê a tua carta de condução', value = 'checkDriver'},
  42.               {label = 'Mostra a tua carta de condução', value = 'showDriver'},
  43.               {label = 'Vê a tua licença de armas', value = 'checkFirearms'},
  44.               {label = 'Mostra a tua licença de armas', value = 'showFirearms'},
  45.           }
  46.       },
  47.       function(data, menu)
  48.           local val = data.current.value
  49.          
  50.           if val == 'checkID' then
  51.               TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()))
  52.           elseif val == 'checkDriver' then
  53.               TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'driver')
  54.           elseif val == 'checkFirearms' then
  55.               TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'weapon')
  56.           else
  57.               local player, distance = ESX.Game.GetClosestPlayer()
  58.              
  59.               if distance ~= -1 and distance <= 3.0 then
  60.                   if val == 'showID' then
  61.                   TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player))
  62.                   elseif val == 'showDriver' then
  63.               TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player), 'driver')
  64.                   elseif val == 'showFirearms' then
  65.               TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player), 'weapon')
  66.                   end
  67.               else
  68.                 ESX.ShowNotification('Sem jogadores por perto')
  69.               end
  70.           end
  71.       end,
  72.       function(data, menu)
  73.           menu.close()
  74.       end
  75.   )
  76.   end
  77.  
  78.   Citizen.CreateThread(function()
  79.       while true do
  80.           Citizen.Wait(1)
  81.           if IsControlJustReleased(0, Keys['F5']) then
  82.               openMenu()
  83.           end
  84.       end
  85.   end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement