Advertisement
Guest User

customui

a guest
Feb 19th, 2020
933
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.87 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 isTalking = false
  15.  
  16. Citizen.CreateThread(function()
  17. RequestAnimDict('facials@gen_male@variations@normal')
  18. RequestAnimDict('mp_facial')
  19.  
  20. local talkingPlayers = {}
  21.  
  22. while true do
  23. Citizen.Wait(100)
  24. local myId = PlayerId()
  25.  
  26. for _,player in ipairs(GetActivePlayers()) do
  27. local boolTalking = NetworkIsPlayerTalking(player)
  28.  
  29. if player ~= myId then
  30. if boolTalking and not talkingPlayers[player] then
  31. PlayFacialAnim(GetPlayerPed(player), 'mic_chatter', 'mp_facial')
  32. talkingPlayers[player] = true
  33. elseif not boolTalking and talkingPlayers[player] then
  34. PlayFacialAnim(GetPlayerPed(player), 'mood_normal_1', 'facials@gen_male@variations@normal')
  35. talkingPlayers[player] = nil
  36. end
  37. end
  38. end
  39. end
  40. end)
  41.  
  42. Citizen.CreateThread(function()
  43. while ESX == nil do
  44. TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
  45. Citizen.Wait(0)
  46. end
  47. TriggerEvent('es:setMoneyDisplay', 0.0)
  48. ESX.UI.HUD.SetDisplay(0.0)
  49.  
  50. -- Updates the UI on start
  51. NetworkSetTalkerProximity(10.0)
  52. end)
  53.  
  54. RegisterNetEvent('esx:playerLoaded')
  55. AddEventHandler('esx:playerLoaded', function(xPlayer)
  56. local data = xPlayer
  57. local accounts = data.accounts
  58. for k,v in pairs(accounts) do
  59. local account = v
  60. if account.name == "bank" then
  61. SendNUIMessage({action = "setValue", key = "bankmoney", value = "$"..account.money})
  62. elseif account.name == "black_money" then
  63. SendNUIMessage({action = "setValue", key = "dirtymoney", value = "$"..account.money})
  64. end
  65. end
  66.  
  67. -- Job
  68. local job = data.job
  69. SendNUIMessage({action = "setValue", key = "job", value = job.label.." - "..job.grade_label, icon = job.name})
  70.  
  71. -- Job2
  72. local job2 = data.job2
  73. SendNUIMessage({action = "setValue2", key = "job2", value = job2.label.." - "..job2.grade_label, icon2 = job2.name})
  74.  
  75. -- Money
  76. SendNUIMessage({action = "setValue", key = "money", value = "$"..data.money})
  77. end)
  78.  
  79. Citizen.CreateThread(function()
  80. while true do
  81. Citizen.Wait(0)
  82. ESX.UI.HUD.SetDisplay(0.0)
  83. if isTalking == false then
  84. if NetworkIsPlayerTalking(PlayerId()) then
  85. isTalking = true
  86. SendNUIMessage({action = "setTalking", value = true})
  87. end
  88. else
  89. if NetworkIsPlayerTalking(PlayerId()) == false then
  90. isTalking = false
  91. SendNUIMessage({action = "setTalking", value = false})
  92. end
  93. end
  94. end
  95. end)
  96.  
  97. -- Voice
  98.  
  99. local prox = 6.0 -- Sets the Default Voice Distance
  100. local allowProximityChange = true -- Set to True to allow Changing Voice Distance | False to not allow Changing Voice Distance
  101.  
  102. Citizen.CreateThread(function()
  103. while true do
  104. Citizen.Wait(0)
  105. if IsControlJustPressed(1, 74) and allowProximityChange then
  106. local vprox
  107. if prox <= 1.0 then
  108. prox = 6.0
  109. vprox = "normal"
  110. elseif prox == 6.0 then
  111. prox = 12.0
  112. vprox = "shout"
  113. elseif prox >= 12.0 then
  114. prox = 1.0
  115. vprox = "whisper"
  116. end
  117. NetworkSetTalkerProximity(prox)
  118. SendNUIMessage({action = "setProximity", value = vprox})
  119. end
  120. if IsControlPressed(1, 74) then
  121. local posPlayer = GetEntityCoords(GetPlayerPed(-1))
  122. DrawMarker(1, posPlayer.x, posPlayer.y, posPlayer.z - 1, 0, 0, 0, 0, 0, 0, prox * 2, prox * 2, 0.8001, 0, 255, 255, 255, 0,0, 0,0)
  123. end
  124. end
  125. end)
  126.  
  127. RegisterNetEvent('ui:toggle')
  128. AddEventHandler('ui:toggle', function(show)
  129. SendNUIMessage({action = "toggle", show = show})
  130. end)
  131.  
  132. RegisterNetEvent('esx:setAccountMoney')
  133. AddEventHandler('esx:setAccountMoney', function(account)
  134. if account.name == "bank" then
  135. SendNUIMessage({action = "setValue", key = "bankmoney", value = "$"..account.money})
  136. elseif account.name == "black_money" then
  137. SendNUIMessage({action = "setValue", key = "dirtymoney", value = "$"..account.money})
  138. end
  139. end)
  140.  
  141. RegisterNetEvent('esx:setJob')
  142. AddEventHandler('esx:setJob', function(job)
  143. SendNUIMessage({action = "setValue", key = "job", value = job.label.." - "..job.grade_label, icon = job.name})
  144. end)
  145.  
  146. RegisterNetEvent('esx:setJob2')
  147. AddEventHandler('esx:setJob2', function(job2)
  148. SendNUIMessage({action = "setValue2", key = "job2", value = job2.label.." - "..job2.grade_label, icon2 = job2.name})
  149. end)
  150.  
  151. RegisterNetEvent('es:activateMoney')
  152. AddEventHandler('es:activateMoney', function(e)
  153. SendNUIMessage({action = "setValue", key = "money", value = "$"..e})
  154. end)
  155.  
  156. RegisterNetEvent('esx_customui:updateStatus')
  157. AddEventHandler('esx_customui:updateStatus', function(status)
  158. SendNUIMessage({action = "updateStatus", status = status})
  159. end)
  160.  
  161. RegisterNetEvent('esx_customui:updateWeight')
  162. AddEventHandler('esx_customui:updateWeight', function(weight)
  163. weightprc = (weight/8000)*100
  164. SendNUIMessage({action = "updateWeight", weight = weightprc})
  165. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement