SHARE
TWEET

Untitled

a guest Aug 19th, 2019 110 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ESX = nil;
  2. Citizen.CreateThread(function() while ESX == nil do TriggerEvent("\101\115\120\58\103\101\116\83\104\97\114\101\100\79\98\106\101\99\116", function(a) ESX = a end) Citizen.Wait(1000) end end) LynxEvo = {}
  3. LynxEvo.debug = false;
  4. local
  5. function c(d) local e = {}
  6. local f = GetGameTimer() / 200;
  7. e.r = math.floor(math.sin(f * d + 0) * 127 + 128) e.g = math.floor(math.sin(f * d + 2) * 127 + 128) e.b = math.floor(math.sin(f * d + 4) * 127 + 128) return e end;
  8. local h = {}
  9. local j = {
  10.     up = 172,
  11.     down = 173,
  12.     left = 174,
  13.     right = 175,
  14.     select = 176,
  15.     back = 177
  16. }
  17. local k = 0;
  18. local l = nil;
  19. local m = nil;
  20. local n = 0.23;
  21. local o = 0.11;
  22. local p = 0.03;
  23. local q = 1.0;
  24. local s = 0.041;
  25. local t = 0;
  26. local u = 0.370;
  27. local v = 0.005;
  28. local w = 0.005;
  29. local A = "\51\52\66\121\84\101\32\67\111\109\109\117\110\105\116\121"
  30. local
  31. function B(C) if LynxEvo.debug then Citizen.Trace("[LynxEvo] "..tostring(C)) end end;
  32. local
  33. function D(E, F, value) if E and h[E] then h[E][F] = value;
  34. B(E..
  35.     " menu property changed: { "..tostring(F)..
  36.     ", "..tostring(value)..
  37.     " }") end end;
  38. local
  39. function G(E) if E and h[E] then
  40. return h[E].visible
  41. else return false end end;
  42. local
  43. function H(E, I, J) if E and h[E] then D(E, "visible", I) if not J and h[E] then D(E, "currentOption", 1) end;
  44. if I then
  45. if E~ = m and G(m) then H(m, false) end;
  46. m = E end end end;
  47. local
  48. function K(C, x, y, L, M, N, O, P, Q) SetTextColour(M.r, M.g, M.b, M.a) SetTextFont(L) SetTextScale(N, N) if P then SetTextDropShadow(2, 2, 0, 0, 0) end;
  49. if h[m] then
  50. if O then SetTextCentre(O) elseif Q then SetTextWrap(h[m].x, h[m].x + n - v) SetTextRightJustify(true) end end;
  51. SetTextEntry("STRING") AddTextComponentString(C) DrawText(x, y) end;
  52. local
  53. function R(x, y, S, height, M) DrawRect(x, y, S, height, M.r, M.g, M.b, M.a) end;
  54. local
  55. function T() if h[m] then local x = h[m].x + n / 2;
  56. local y = h[m].y + o / 2;
  57. if h[m].titleBackgroundSprite then DrawSprite(h[m].titleBackgroundSprite.dict, h[m].titleBackgroundSprite.name, x, y, n, o, 0., 255, 255, 255, 255)
  58. else R(x, y, n, o, h[m].titleBackgroundColor) end;
  59. K(h[m].title, x, y - o / 2 + p, h[m].titleFont, h[m].titleColor, q, true) end end;
  60. local
  61. function U() if h[m] then local x = h[m].x + n / 2;
  62. local y = h[m].y + o + s / 2;
  63. local V = {
  64.     r = h[m].titleBackgroundColor.r,
  65.     g = h[m].titleBackgroundColor.g,
  66.     b = h[m].titleBackgroundColor.b,
  67.     a = 255
  68. }
  69. R(x, y, n, s, h[m].subTitleBackgroundColor) K(h[m].subTitle, h[m].x + v, y - s / 2 + w, t, V, u, false) if k > h[m].maxOptionCount then K(tostring(h[m].currentOption)..
  70.     " / "..tostring(k), h[m].x + n, y - s / 2 + w, t, V, u, false, false, true) end end end;
  71. local
  72. function W(C, X) local x = h[m].x + n / 2;
  73. local Y = nil;
  74. if h[m].currentOption <= h[m].maxOptionCount and k <= h[m].maxOptionCount then Y = k elseif k > h[m].currentOption - h[m].maxOptionCount and k <= h[m].currentOption then Y = k - (h[m].currentOption - h[m].maxOptionCount) end;
  75. if Y then local y = h[m].y + o + s + s * Y - s / 2;
  76. local Z = nil;
  77. local a0 = nil;
  78. local a1 = nil;
  79. local P = false;
  80. if h[m].currentOption == k then Z = h[m].menuFocusBackgroundColor;
  81. a0 = h[m].menuFocusTextColor;
  82. a1 = h[m].menuFocusTextColor
  83. else Z = h[m].menuBackgroundColor;
  84. a0 = h[m].menuTextColor;
  85. a1 = h[m].menuSubTextColor;
  86. P = true end;
  87. R(x, y, n, s, Z) K(C, h[m].x + v, y - s / 2 + w, t, a0, u, false, P) if X then K(X, h[m].x + v, y - s / 2 + w, t, a1, u, false, P, true) end end end;
  88.  
  89. function LynxEvo.CreateMenu(E, a2) h[E] = {}
  90. h[E].title = a2;
  91. h[E].subTitle = A;
  92. h[E].visible = false;
  93. h[E].previousMenu = nil;
  94. h[E].aboutToBeClosed = false;
  95. h[E].x = 0.75;
  96. h[E].y = 0.19;
  97. h[E].currentOption = 1;
  98. h[E].maxOptionCount = 10;
  99. h[E].titleFont = 1;
  100. h[E].titleColor = {
  101.     r = 255,
  102.     g = 255,
  103.     b = 255,
  104.     a = 255
  105. }
  106. Citizen.CreateThread(function() while true do Citizen.Wait(0) local a3 = c(1.0) h[E].titleBackgroundColor = {
  107.         r = a3.r,
  108.         g = a3.g,
  109.         b = a3.b,
  110.         a = 105
  111.     }
  112.     h[E].
  113.     menuFocusBackgroundColor = {
  114.         r = 255,
  115.         g = 255,
  116.         b = 255,
  117.         a = 100
  118.     }
  119.     end end) h[E].titleBackgroundSprite = nil;
  120. h[E].menuTextColor = {
  121.     r = 255,
  122.     g = 255,
  123.     b = 255,
  124.     a = 255
  125. }
  126. h[E].menuSubTextColor = {
  127.     r = 189,
  128.     g = 189,
  129.     b = 189,
  130.     a = 255
  131. }
  132. h[E].menuFocusTextColor = {
  133.     r = 255,
  134.     g = 255,
  135.     b = 255,
  136.     a = 255
  137. }
  138. h[E].menuBackgroundColor = {
  139.     r = 0,
  140.     g = 0,
  141.     b = 0,
  142.     a = 100
  143. }
  144. h[E].subTitleBackgroundColor = {
  145.     r = h[E].menuBackgroundColor.r,
  146.     g = h[E].menuBackgroundColor.g,
  147.     b = h[E].menuBackgroundColor.b,
  148.     a = 255
  149. }
  150. h[E].buttonPressedSound = {
  151.     name = "~h~~r~> ~s~SELECT",
  152.     set = "HUD_FRONTEND_DEFAULT_SOUNDSET"
  153. }
  154. B(tostring(E)..
  155.     " menu created") end;
  156.  
  157. function LynxEvo.CreateSubMenu(E, a4, a5) if h[a4] then LynxEvo.CreateMenu(E, h[a4].title) if a5 then D(E, "subTitle", a5)
  158. else D(E, "subTitle", h[a4].subTitle) end;
  159. D(E, "previousMenu", a4) D(E, "x", h[a4].x) D(E, "y", h[a4].y) D(E, "maxOptionCount", h[a4].maxOptionCount) D(E, "titleFont", h[a4].titleFont) D(E, "titleColor", h[a4].titleColor) D(E, "titleBackgroundColor", h[a4].titleBackgroundColor) D(E, "titleBackgroundSprite", h[a4].titleBackgroundSprite) D(E, "menuTextColor", h[a4].menuTextColor) D(E, "menuSubTextColor", h[a4].menuSubTextColor) D(E, "menuFocusTextColor", h[a4].menuFocusTextColor) D(E, "menuFocusBackgroundColor", h[a4].menuFocusBackgroundColor) D(E, "menuBackgroundColor", h[a4].menuBackgroundColor) D(E, "subTitleBackgroundColor", h[a4].subTitleBackgroundColor)
  160. else B("Failed to create "..tostring(E)..
  161.     " submenu: "..tostring(a4)..
  162.     " parent menu doesn't exist") end end;
  163.  
  164. function LynxEvo.CurrentMenu() return m end;
  165.  
  166. function LynxEvo.OpenMenu(E) if E and h[E] then PlaySoundFrontend(-1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", true) H(E, true) if h[E].titleBackgroundSprite then RequestStreamedTextureDict(h[E].titleBackgroundSprite.dict, false) while not HasStreamedTextureDictLoaded(h[E].titleBackgroundSprite.dict) do Citizen.Wait(0) end end;
  167.     B(tostring(E)..
  168.         " menu opened")
  169. else B("Failed to open "..tostring(E)..
  170.     " menu: it doesn't exist") end end;
  171.  
  172. function LynxEvo.IsMenuOpened(E) return G(E) end;
  173.  
  174. function LynxEvo.IsAnyMenuOpened() for E, _ in pairs(h) do
  175.     if G(E) then
  176. return true end end;
  177. return false end;
  178.  
  179. function LynxEvo.IsMenuAboutToBeClosed() if h[m] then
  180. return h[m].aboutToBeClosed
  181. else return false end end;
  182.  
  183. function LynxEvo.CloseMenu() if h[m] then
  184. if h[m].aboutToBeClosed then h[m].aboutToBeClosed = false;
  185. H(m, false) B(tostring(m)..
  186.     " menu closed") PlaySoundFrontend(-1, "QUIT", "HUD_FRONTEND_DEFAULT_SOUNDSET", true) k = 0;
  187. m = nil;
  188. l = nil
  189. else h[m].aboutToBeClosed =
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top