Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.03 KB | None | 0 0
  1. vRP = Proxy.getInterface("vRP")
  2.  
  3. vRPsb = {}
  4. Tunnel.bindInterface("vrp_ui",vRPsb)
  5. Proxy.addInterface("vrp_ui",vRPsb)
  6.  
  7. local key = 212 -- https://wiki.fivem.net/wiki/Controls
  8. local voice = 0
  9.  
  10. local cfg = {
  11. {
  12. distance = 45.0001,
  13. text = "Råber"
  14. },
  15. {
  16. distance = 2.0001,
  17. text = "Hvisker"
  18. },
  19. {
  20. distance = 12.0001,
  21. text = "Normal"
  22. },
  23. }
  24. local health = -1
  25. local piss = -1
  26. local hunger = -1
  27. local thirst = -1
  28. local showUI = true
  29.  
  30. function vRPsb.setUIBar(type,amount)
  31. if type == "health" then health = amount
  32. elseif type == "piss" then piss = 100-math.floor(math.abs(amount))
  33. elseif type == "hunger" then hunger = 100-math.floor(math.abs(amount))
  34. elseif type == "thirst" then thirst = 100-math.floor(math.abs(amount))
  35. end
  36. end
  37.  
  38. function vRPsb.showUI(bool)
  39. showUI = bool
  40. end
  41.  
  42.  
  43. function drawTxt(x,y ,width,height,scale, text, r,g,b,a)
  44. SetTextFont(4)
  45. SetTextProportional(0)
  46. SetTextScale(scale, scale)
  47. SetTextColour(r, g, b, a)
  48. SetTextDropShadow(0, 0, 0, 0,255)
  49. SetTextEdge(2, 0, 0, 0, 255)
  50. SetTextDropShadow()
  51. SetTextOutline()
  52. SetTextEntry("STRING")
  53. AddTextComponentString(text)
  54. DrawText(x - width/2, y - height/2 + 0.005)
  55. end
  56.  
  57.  
  58. function drawRct(x,y,width,height,r,g,b,a)
  59. DrawRect(x + width/2, y + height/2, width, height, r, g, b, a)
  60. end
  61.  
  62.  
  63. Citizen.CreateThread(function()
  64. while true do
  65. Citizen.Wait(0)
  66. if IsControlJustPressed(1, key) then
  67. voice = voice + 1
  68. if voice > 3 then voice = 1 end
  69. NetworkSetTalkerProximity(cfg[voice].distance)
  70. TriggerEvent("pNotify:SendNotification",{text = "Talerækkevide: <b style='color: #4E9350'>"..cfg[voice].text.."</b>",
  71. type = "info",timeout = 4000, layout = "centerRight",animation = {open = "gta_effects_fade_in", close = "gta_effects_fade_out"},killer=true})
  72. end
  73. end
  74. end)
  75.  
  76. local height = 0.011
  77. local bar1 = 0.970
  78. local bar2 = 0.9835
  79. local talebaroffset = 0.0862
  80. Citizen.CreateThread(function()
  81. while true do
  82. Citizen.Wait(0)
  83. if showUI then
  84. drawRct(0.0135, 0.96695, 0.1440,0.030,32,32,34,255)
  85. if IsPedInAnyVehicle(PlayerPedId(), false) then
  86. drawRct(0.11,bar1-0.001, 0.046,height+0.001,100,100,100,255)
  87. if NetworkIsPlayerTalking(PlayerId()) then
  88. if voice == 1 then
  89. drawRct(0.11,bar1-0.001, 0.046,height+0.001,255, 93, 69,255)
  90. elseif voice == 2 then
  91. drawRct(0.11,bar1-0.001, 0.015333,height+0.001,255, 93, 69,255)
  92. else
  93. drawRct(0.11,bar1-0.001, 0.030333,height+0.001,255, 93, 69,255)
  94. end
  95. else
  96. if voice == 1 then
  97. drawRct(0.11,bar1-0.001, 0.046,height+0.001,234, 234, 234,255)
  98. elseif voice == 2 then
  99. drawRct(0.11,bar1-0.001, 0.015333,height+0.001,234, 234, 234,255)
  100. else
  101. drawRct(0.11,bar1-0.001, 0.030333,height+0.001,234, 234, 234,255)
  102. end
  103. end
  104.  
  105. local vdamage = GetEntityHealth(GetVehiclePedIsIn(GetPlayerPed(-1), false)) -100
  106. drawRct(0.0625,bar1-0.001, 0.046,height+0.001,98, 161, 117, 255)
  107. drawRct(0.0625,bar1-0.001, (0.000046 * tonumber(vdamage)),height+0.001,98, 255, 117, 255)
  108. drawTxt(0.0980,bar1-0.00420, 0.0350,0.01,0.24, math.floor(vdamage) , 255, 255, 255, 255)
  109. health = GetEntityHealth(GetPlayerPed(-1)) - 100
  110. if health ~= -1 then
  111. drawRct(0.015,bar1-0.001, 0.046,height+0.001,0, 120, 0,255)
  112. if health == 0 then
  113. drawTxt(0.0510,bar1-0.00420, 0.046,0.01,0.24, "Død" , 255, 255, 255, 255)
  114. end
  115. drawRct(0.015,bar1-0.001, (0.00046 * health),height+0.001,0, 195, 0,255)
  116. drawTxt(0.0510,bar1-0.00420, 0.0350,0.01,0.24, math.floor(health) , 255, 255, 255, 255)
  117. end
  118. else
  119. local armor = GetPedArmour(PlayerPedId())
  120. local talebarwidth = 0.07
  121. local healthtxt = 0.0650
  122. if armor > 0 then
  123. drawRct(0.0625,bar1-0.001, 0.046,height+0.001,63, 159, 104,255)
  124. drawRct(0.0625,bar1-0.001, (0.00046 * armor),height+0.001,63, 240, 104,255)
  125. drawTxt(0.1,bar1-0.00420, 0.0350,0.01,0.24, math.floor(armor) , 255, 255, 255, 255)
  126. talebaroffset = 0.11
  127. talebarwidth = 0.046
  128. healthtxt = healthtxt/1.40
  129. else
  130. talebaroffset = 0.0862
  131. end
  132. drawRct(talebaroffset,bar1-0.001, talebarwidth,height+0.001,100,100,100,255)
  133. if NetworkIsPlayerTalking(PlayerId()) then
  134. if voice == 1 then
  135. drawRct(talebaroffset,bar1-0.001, talebarwidth,height+0.001,255, 93, 69,255)
  136. elseif voice == 2 then
  137. drawRct(talebaroffset,bar1-0.001, talebarwidth/3,height+0.001,255, 93, 69,255)
  138. else
  139. drawRct(talebaroffset,bar1-0.001, talebarwidth/1.5,height+0.001,255, 93, 69,255)
  140. end
  141. else
  142. if voice == 1 then
  143. drawRct(talebaroffset,bar1-0.001, talebarwidth,height+0.001,234, 234, 234,255)
  144. elseif voice == 2 then
  145. drawRct(talebaroffset,bar1-0.001, talebarwidth/3,height+0.001,234, 234, 234,255)
  146. else
  147. drawRct(talebaroffset,bar1-0.001, talebarwidth/1.5,height+0.001,234, 234, 234,255)
  148. end
  149. end
  150. health = GetEntityHealth(GetPlayerPed(-1)) - 100
  151. if health ~= -1 then
  152. drawRct(0.015,bar1-0.001, talebarwidth,height+0.001,0, 120, 0,255)
  153. if health == 0 then
  154. drawTxt(healthtxt,bar1-0.00420, talebarwidth/2,0.01,0.24, "Død" , 255, 255, 255, 255)
  155. end
  156. drawRct(0.015,bar1-0.001, ((talebarwidth/100) * health),height+0.001,0, 195, 0,255)
  157. drawTxt(healthtxt,bar1-0.00420, talebarwidth/2,0.01,0.24, math.floor(health) , 255, 255, 255, 255)
  158. end
  159. end
  160. drawRct(0.015,bar2, 0.046,height,255, 104, 0,255)
  161. if hunger ~= -1 then
  162. drawRct(0.015,bar2, (0.00046 * hunger),height,255, 152, 0,255)
  163. if hunger < 25 then
  164. drawTxt(0.0545,bar2-0.00420, 0.046,0.01,0.24, "Sulter" , 255, 255, 255, 255)
  165. end
  166. end
  167. drawRct(0.0625,bar2, 0.046,height,0, 103, 251,255)
  168. if thirst ~= -1 then
  169. drawRct(0.0625,bar2, (0.00046 * thirst),height,0, 160, 251,255)
  170. if thirst < 25 then
  171. drawTxt(0.1000,bar2-0.00420, 0.046,0.01,0.24, "Tørster" , 255, 255, 255, 255)
  172. end
  173. end
  174. drawRct(0.11,bar2, 0.046,height,255, 159, 0,255)
  175. if piss ~= -1 then
  176. drawRct(0.11,bar2, (0.00046 * piss),height,255, 229, 0,255)
  177. end
  178. end
  179. end
  180. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement