Ledger Nano X - The secure hardware wallet
SHARE
TWEET

esx_billing

a guest Mar 4th, 2019 223 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 isDead = false
  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. function ShowBillsMenu()
  24.  
  25.     ESX.TriggerServerCallback('esx_billing:getBills', function(bills)
  26.         ESX.UI.Menu.CloseAll()
  27.         local elements = {}
  28.  
  29.         for i=1, #bills, 1 do
  30.             table.insert(elements, {
  31.                 label  = ('%s - <span style="color:red;">%s</span>'):format(bills[i].label, _U('invoices_item', ESX.Math.GroupDigits(bills[i].amount))),
  32.                 billID = bills[i].id
  33.             })
  34.         end
  35.  
  36.         ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'billing',
  37.         {
  38.             title    = _U('invoices'),
  39.             align    = 'bottom-right',
  40.             elements = elements
  41.         }, function(data, menu)
  42.             menu.close()
  43.  
  44.             ESX.TriggerServerCallback('esx_billing:payBill', function()
  45.                 ShowBillsMenu()
  46.             end, data.current.billID)
  47.         end, function(data, menu)
  48.             menu.close()
  49.         end)
  50.     end)
  51.  
  52. end
  53.  
  54. -- Key controls
  55. Citizen.CreateThread(function()
  56.     while true do
  57.         Citizen.Wait(0)
  58.         if IsControlJustReleased(0, Keys['']) and not isDead and not ESX.UI.Menu.IsOpen('default', GetCurrentResourceName(), 'billing') then
  59.             ShowBillsMenu()
  60.         end
  61.     end
  62. end)
  63.  
  64. AddEventHandler('esx:onPlayerDeath', function(data)
  65.     isDead = true
  66. end)
  67.  
  68. AddEventHandler('playerSpawned', function(spawn)
  69.     isDead = false
  70. end)
  71.  
  72. ---------------------------------------------------------------------------------------------------------
  73. --NB : gestion des menu
  74. ---------------------------------------------------------------------------------------------------------
  75.  
  76. RegisterNetEvent('NB:openMenuFactures')
  77. AddEventHandler('NB:openMenuFactures', function()
  78.     ShowBillsMenu()
  79. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top