· 6 years ago · Oct 03, 2019, 07:54 PM
1--==================================================================================================================================================--
2--[[ NativeUI\Wrapper\Ordered Table ]]
3--==================================================================================================================================================--
4oTable = {}
5do
6 function oTable.insert(t, k, v)
7 if not rawget(t._values, k) then -- new key
8 t._keys[#t._keys + 1] = k
9 end
10 if v == nil then -- delete key too.
11 oTable.remove(t, k)
12 else -- update/store value
13 t._values[k] = v
14 end
15 end
16
17 local function find(t, value)
18 for i,v in ipairs(t) do
19 if v == value then
20 return i
21 end
22 end
23 end
24
25 function oTable.remove(t, k)
26 local v = t._values[k]
27 if v ~= nil then
28 table.remove(t._keys, find(t._keys, k))
29 t._values[k] = nil
30 end
31 return v
32 end
33
34 function oTable.index(t, k)
35 return rawget(t._values, k)
36 end
37
38 function oTable.pairs(t)
39 local i = 0
40 return function()
41 i = i + 1
42 local key = t._keys[i]
43 if key ~= nil then
44 return key, t._values[key]
45 end
46 end
47 end
48
49 function oTable.new(init)
50 init = init or {}
51 local t = {_keys={}, _values={}}
52 local n = #init
53 if n % 2 ~= 0 then
54 error"in oTable initialization: key is missing value"
55 end
56 for i=1,n/2 do
57 local k = init[i * 2 - 1]
58 local v = init[i * 2]
59 if t._values[k] ~= nil then
60 error("duplicate key:"..k)
61 end
62 t._keys[#t._keys + 1] = k
63 t._values[k] = v
64 end
65 return setmetatable(t,
66 {__newindex=oTable.insert,
67 __len=function(t) return #t._keys end,
68 __pairs=oTable.pairs,
69 __index=t._values
70 })
71 end
72end
73
74--==================================================================================================================================================--
75--[[ NativeUI\Wrapper\Utility ]]
76--==================================================================================================================================================--
77do
78 function table.Contains(table, val)
79 for index, value in pairs(table) do if value == val then return true end end
80 return false
81 end
82
83 function table.ContainsKey(table, key)
84 return table[key] ~= nil
85 end
86
87 function table.Count(table)
88 local count = 0
89 if table ~= nil then
90 for _ in pairs(table) do count = count + 1 end
91 end
92 return count
93 end
94
95 function string.IsNullOrEmpty(str) return str == nil or str == '' end
96
97 function GetResolution()
98 local W, H = 1920, 1080
99 if GetActiveScreenResolution ~= nil then
100 W, H = GetActiveScreenResolution()
101 elseif GetScreenActiveResolution ~= nil then
102 W, H = GetScreenActiveResolution()
103 else
104 W, H = N_0x873c9f3104101dd3()
105 end
106 if (W / H) > 3.5 then W, H = GetScreenResolution() end
107 if W < 1920 then W = 1920 end
108 if H < 1080 then H = 1080 end
109 return W, H
110 end
111
112 function FormatXWYH(Value, Value2)
113 local W, H = GetScreenResolution()
114 local AW, AH = GetResolution()
115 local XW = Value * (1 / W - ((1 / W) - (1 / AW)))
116 local YH = Value2 * (1 / H - ((1 / H) - (1 / AH)))
117 return XW, YH
118 end
119
120 function ReverseFormatXWYH(Value, Value2)
121 local W, H = GetScreenResolution()
122 local AW, AH = GetResolution()
123 local XW = Value / (1 / W - (1 * (1 / W) - (1 / AW)))
124 local YH = Value2 / (1 / H - ((1 / H) - (1 / AH)))
125 return XW, YH
126 end
127
128 function ConvertToPixel(x, y)
129 local AW, AH = GetResolution()
130 return math.round(x * AW), math.round(y * AH)
131 end
132
133 function math.round(num, numDecimalPlaces) return tonumber(string.format("%." .. (numDecimalPlaces or 0) .. "f", num)) end
134
135 function math.trim(value) if value then return (string.gsub(value, "^%s*(.-)%s*$", "%1")) else return nil end end
136
137 function ToBool(input)
138 if input == "true" or tonumber(input) == 1 or input == true then
139 return true
140 else
141 return false
142 end
143 end
144
145 function string.split(inputstr, sep)
146 if sep == nil then sep = "%s" end
147 local t = {}
148 local i = 1
149 for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do
150 t[i] = str
151 i = i + 1
152 end
153 return t
154 end
155
156 function string.starts(String, Start) return string.sub(String, 1, string.len(Start)) == Start end
157
158 function IsMouseInBounds(X, Y, Width, Height, DrawOffset)
159 local W, H = GetResolution()
160 local MX, MY = math.round(GetControlNormal(0, 239) * W), math.round(GetControlNormal(0, 240) * H)
161 MX, MY = FormatXWYH(MX, MY)
162 X, Y = FormatXWYH(X, Y)
163 if DrawOffset then
164 X = X + DrawOffset.X
165 Y = Y + DrawOffset.Y
166 end
167 Width, Height = FormatXWYH(Width, Height)
168 return (MX >= X and MX <= X + Width) and (MY > Y and MY < Y + Height)
169 end
170
171 function TableDump(o)
172 if type(o) == 'table' then
173 local s = '{ '
174 for k, v in pairs(o) do
175 if type(k) ~= 'number' then k = '"' .. k .. '"' end
176 s = s .. '[' .. k .. '] = ' .. TableDump(v) .. ','
177 end
178 return s .. '} '
179 else
180 return print(tostring(o))
181 end
182 end
183
184 function Controller()
185 return not GetLastInputMethod(2) -- IsInputDisabled() --N_0xA571D46727E2B718
186 end
187
188 function RenderText(Text, X, Y, Font, Scale, R, G, B, A, Alignment, DropShadow, Outline, WordWrap)
189 Text = tostring(Text)
190 X, Y = FormatXWYH(X, Y)
191 SetTextFont(Font or 0)
192 SetTextScale(1.0, Scale or 0)
193 SetTextColour(R or 255, G or 255, B or 255, A or 255)
194
195 if DropShadow then SetTextDropShadow() end
196 if Outline then SetTextOutline() end
197
198 if Alignment ~= nil then
199 if Alignment == 1 or Alignment == "Center" or Alignment == "Centre" then
200 SetTextCentre(true)
201 elseif Alignment == 2 or Alignment == "Right" then
202 SetTextRightJustify(true)
203 SetTextWrap(0, X)
204 end
205 end
206
207 if tonumber(WordWrap) then
208 if tonumber(WordWrap) ~= 0 then
209 WordWrap, _ = FormatXWYH(WordWrap, 0)
210 SetTextWrap(WordWrap, X - WordWrap)
211 end
212 end
213
214 if BeginTextCommandDisplayText ~= nil then
215 BeginTextCommandDisplayText("STRING")
216 else
217 SetTextEntry("STRING")
218 end
219 AddLongString(Text)
220
221 if EndTextCommandDisplayText ~= nil then
222 EndTextCommandDisplayText(X, Y)
223 else
224 DrawText(X, Y)
225 end
226 end
227
228 function DrawRectangle(X, Y, Width, Height, R, G, B, A)
229 X, Y, Width, Height = X or 0, Y or 0, Width or 0, Height or 0
230 X, Y = FormatXWYH(X, Y)
231 Width, Height = FormatXWYH(Width, Height)
232 DrawRect(X + Width * 0.5, Y + Height * 0.5, Width, Height, tonumber(R) or 255, tonumber(G) or 255, tonumber(B) or 255,
233 tonumber(A) or 255)
234 end
235
236 function DrawTexture(TxtDictionary, TxtName, X, Y, Width, Height, Heading, R, G, B, A)
237 if not HasStreamedTextureDictLoaded(tostring(TxtDictionary) or "") then
238 RequestStreamedTextureDict(tostring(TxtDictionary) or "", true)
239 end
240 X, Y, Width, Height = X or 0, Y or 0, Width or 0, Height or 0
241 X, Y = FormatXWYH(X, Y)
242 Width, Height = FormatXWYH(Width, Height)
243 DrawSprite(tostring(TxtDictionary) or "", tostring(TxtName) or "", X + Width * 0.5, Y + Height * 0.5, Width, Height,
244 tonumber(Heading) or 0, tonumber(R) or 255, tonumber(G) or 255, tonumber(B) or 255, tonumber(A) or 255)
245 end
246
247 function PrintTable(node)
248 -- to make output beautiful
249 local function tab(amt)
250 local str = ""
251 for i = 1, amt do str = str .. "\t" end
252 return str
253 end
254
255 local cache, stack, output = {}, {}, {}
256 local depth = 1
257 local output_str = "{\n"
258
259 while true do
260 local size = 0
261 for k, v in pairs(node) do size = size + 1 end
262
263 local cur_index = 1
264 for k, v in pairs(node) do
265 if (cache[node] == nil) or (cur_index >= cache[node]) then
266
267 if (string.find(output_str, "}", output_str:len())) then
268 output_str = output_str .. ",\n"
269 elseif not (string.find(output_str, "\n", output_str:len())) then
270 output_str = output_str .. "\n"
271 end
272
273 -- This is necessary for working with HUGE tables otherwise we run out of memory using concat on huge strings
274 table.insert(output, output_str)
275 output_str = ""
276
277 local key
278 if (type(k) == "number" or type(k) == "boolean") then
279 key = "[" .. tostring(k) .. "]"
280 else
281 key = "['" .. tostring(k) .. "']"
282 end
283
284 if (type(v) == "number" or type(v) == "boolean") then
285 output_str = output_str .. tab(depth) .. key .. " = " .. tostring(v)
286 elseif (type(v) == "table") then
287 output_str = output_str .. tab(depth) .. key .. " = {\n"
288 table.insert(stack, node)
289 table.insert(stack, v)
290 cache[node] = cur_index + 1
291 break
292 else
293 output_str = output_str .. tab(depth) .. key .. " = '" .. tostring(v) .. "'"
294 end
295
296 if (cur_index == size) then
297 output_str = output_str .. "\n" .. tab(depth - 1) .. "}"
298 else
299 output_str = output_str .. ","
300 end
301 else
302 -- close the table
303 if (cur_index == size) then output_str = output_str .. "\n" .. tab(depth - 1) .. "}" end
304 end
305
306 cur_index = cur_index + 1
307 end
308
309 if (size == 0) then output_str = output_str .. "\n" .. tab(depth - 1) .. "}" end
310
311 if (#stack > 0) then
312 node = stack[#stack]
313 stack[#stack] = nil
314 depth = cache[node] == nil and depth + 1 or depth - 1
315 else
316 break
317 end
318 end
319
320 -- This is necessary for working with HUGE tables otherwise we run out of memory using concat on huge strings
321 table.insert(output, output_str)
322 output_str = table.concat(output)
323
324 print(output_str)
325 end
326
327 --[[ Rainbow Color Generator ]]
328 function GenerateRainbow(frequency)
329 local result = {}
330 local curtime = GetGameTimer() / 1000
331 result.r = math.floor(math.sin(curtime * frequency + 0) * 127 + 128)
332 result.g = math.floor(math.sin(curtime * frequency + 2) * 127 + 128)
333 result.b = math.floor(math.sin(curtime * frequency + 4) * 127 + 128)
334 return result
335 end
336end
337
338--==================================================================================================================================================--
339--[[ NativeUI\UIElements\UIVisual ]]
340--==================================================================================================================================================--
341UIVisual = setmetatable({}, UIVisual)
342UIVisual.__index = UIVisual
343do
344 function UIVisual:Popup(array)
345 ClearPrints()
346 if (array.colors == nil) then
347 SetNotificationBackgroundColor(140)
348 else
349 SetNotificationBackgroundColor(array.colors)
350 end
351 SetNotificationTextEntry("STRING")
352 if (array.message == nil) then
353 error("Missing arguments, message")
354 else
355 AddTextComponentString(tostring(array.message))
356 end
357 DrawNotification(false, true)
358 if (array.sound ~= nil) then
359 if (array.sound.audio_name ~= nil) then
360 if (array.sound.audio_ref ~= nil) then
361 PlaySoundFrontend(-1, array.sound.audio_name, array.sound.audio_ref, true)
362 else
363 error("Missing arguments, audio_ref")
364 end
365 else
366 error("Missing arguments, audio_name")
367 end
368 end
369 end
370
371 function UIVisual:PopupChar(array)
372 if (array.colors == nil) then
373 SetNotificationBackgroundColor(140)
374 else
375 SetNotificationBackgroundColor(array.colors)
376 end
377 SetNotificationTextEntry("STRING")
378 if (array.message == nil) then
379 error("Missing arguments, message")
380 else
381 AddTextComponentString(tostring(array.message))
382 end
383 if (array.request_stream_texture_dics ~= nil) then RequestStreamedTextureDict(array.request_stream_texture_dics) end
384 if (array.picture ~= nil) then
385 if (array.iconTypes == 1) or (array.iconTypes == 2) or (array.iconTypes == 3) or (array.iconTypes == 7) or
386 (array.iconTypes == 8) or (array.iconTypes == 9) then
387 SetNotificationMessage(tostring(array.picture), tostring(array.picture), true, array.iconTypes, array.sender, array.title)
388 else
389 SetNotificationMessage(tostring(array.picture), tostring(array.picture), true, 4, array.sender, array.title)
390 end
391 else
392 if (array.iconTypes == 1) or (array.iconTypes == 2) or (array.iconTypes == 3) or (array.iconTypes == 7) or
393 (array.iconTypes == 8) or (array.iconTypes == 9) then
394 SetNotificationMessage('CHAR_ALL_PLAYERS_CONF', 'CHAR_ALL_PLAYERS_CONF', true, array.iconTypes, array.sender, array.title)
395 else
396 SetNotificationMessage('CHAR_ALL_PLAYERS_CONF', 'CHAR_ALL_PLAYERS_CONF', true, 4, array.sender, array.title)
397 end
398 end
399 if (array.sound ~= nil) then
400 if (array.sound.audio_name ~= nil) then
401 if (array.sound.audio_ref ~= nil) then
402 PlaySoundFrontend(-1, array.sound.audio_name, array.sound.audio_ref, true)
403 else
404 error("Missing arguments, audio_ref")
405 end
406 else
407 error("Missing arguments, audio_name")
408 end
409 end
410 DrawNotification(false, true)
411 end
412
413 function UIVisual:Text(array)
414 ClearPrints()
415 SetTextEntry_2("STRING")
416 if (array.message ~= nil) then
417 AddTextComponentString(tostring(array.message))
418 else
419 error("Missing arguments, message")
420 end
421 if (array.time_display ~= nil) then
422 DrawSubtitleTimed(tonumber(array.time_display), 1)
423 else
424 DrawSubtitleTimed(6000, 1)
425 end
426 if (array.sound ~= nil) then
427 if (array.sound.audio_name ~= nil) then
428 if (array.sound.audio_ref ~= nil) then
429 PlaySoundFrontend(-1, array.sound.audio_name, array.sound.audio_ref, true)
430 else
431 error("Missing arguments, audio_ref")
432 end
433 else
434 error("Missing arguments, audio_name")
435 end
436 end
437 end
438
439 function UIVisual:FloatingHelpText(array)
440 BeginTextCommandDisplayHelp("STRING")
441 if (array.message ~= nil) then
442 AddTextComponentScaleform(array.message)
443 else
444 error("Missing arguments, message")
445 end
446 EndTextCommandDisplayHelp(0, 0, 1, -1)
447 if (array.sound ~= nil) then
448 if (array.sound.audio_name ~= nil) then
449 if (array.sound.audio_ref ~= nil) then
450 PlaySoundFrontend(-1, array.sound.audio_name, array.sound.audio_ref, true)
451 else
452 error("Missing arguments, audio_ref")
453 end
454 else
455 error("Missing arguments, audio_name")
456 end
457 end
458 end
459
460 function UIVisual:ShowFreemodeMessage(array)
461 if (array.sound ~= nil) then
462 if (array.sound.audio_name ~= nil) then
463 if (array.sound.audio_ref ~= nil) then
464 PlaySoundFrontend(-1, array.sound.audio_name, array.sound.audio_ref, true)
465 else
466 error("Missing arguments, audio_ref")
467 end
468 else
469 error("Missing arguments, audio_name")
470 end
471 end
472 if (array.request_scaleform ~= nil) then
473 local scaleform = Pyta.Request.Scaleform({movie = array.request_scaleform.movie})
474 if (array.request_scaleform.scale ~= nil) then
475 PushScaleformMovieFunction(scaleform, array.request_scaleform.scale)
476 else
477 PushScaleformMovieFunction(scaleform, 'SHOW_SHARD_WASTED_MP_MESSAGE')
478 end
479 else
480 local scaleform = Pyta.Request.Scaleform({movie = 'MP_BIG_MESSAGE_FREEMODE'})
481 if (array.request_scaleform.scale ~= nil) then
482 PushScaleformMovieFunction(scaleform, array.request_scaleform.scale)
483 else
484 PushScaleformMovieFunction(scaleform, 'SHOW_SHARD_WASTED_MP_MESSAGE')
485 end
486 end
487 if (array.title ~= nil) then
488 PushScaleformMovieFunctionParameterString(array.title)
489 else
490 ConsoleLog({message = 'Missing arguments { title = "Nice title" } '})
491 end
492 if (array.message ~= nil) then
493 PushScaleformMovieFunctionParameterString(array.message)
494 else
495 ConsoleLog({message = 'Missing arguments { message = "Yeah display message right now" } '})
496 end
497 if (array.shake_gameplay ~= nil) then ShakeGameplayCam(array.shake_gameplay, 1.0) end
498 if (array.screen_effect_in ~= nil) then StartScreenEffect(array.screen_effect_in, 0, 0) end
499 PopScaleformMovieFunctionVoid()
500 while array.time > 0 do
501 Citizen.Wait(1)
502 array.time = array.time - 1.0
503 StopScreenEffect(scaleform, 255, 255, 255, 255)
504 end
505 if (array.screen_effect_in ~= nil) then StopScreenEffect(array.screen_effect_in) end
506 if (array.screen_effect_out ~= nil) then StartScreenEffect(array.screen_effect_out, 0, 0) end
507 SetScaleformMovieAsNoLongerNeeded(scaleform)
508 end
509end
510
511--==================================================================================================================================================--
512--[[ NativeUI\UIElements\UIResRectangle ]]
513--==================================================================================================================================================--
514UIResRectangle = setmetatable({}, UIResRectangle)
515UIResRectangle.__index = UIResRectangle
516UIResRectangle.__call = function() return "Rectangle" end
517do
518 function UIResRectangle.New(X, Y, Width, Height, R, G, B, A)
519 local _UIResRectangle = {
520 X = tonumber(X) or 0,
521 Y = tonumber(Y) or 0,
522 Width = tonumber(Width) or 0,
523 Height = tonumber(Height) or 0,
524 _Colour = {R = tonumber(R) or 255, G = tonumber(G) or 255, B = tonumber(B) or 255, A = tonumber(A) or 255}
525 }
526 return setmetatable(_UIResRectangle, UIResRectangle)
527 end
528
529 function UIResRectangle:Position(X, Y)
530 if tonumber(X) and tonumber(Y) then
531 self.X = tonumber(X)
532 self.Y = tonumber(Y)
533 else
534 return {X = self.X, Y = self.Y}
535 end
536 end
537
538 function UIResRectangle:Size(Width, Height)
539 if tonumber(Width) and tonumber(Height) then
540 self.Width = tonumber(Width)
541 self.Height = tonumber(Height)
542 else
543 return {Width = self.Width, Height = self.Height}
544 end
545 end
546
547 function UIResRectangle:Colour(R, G, B, A)
548 if tonumber(R) or tonumber(G) or tonumber(B) or tonumber(A) then
549 self._Colour.R = tonumber(R) or 255
550 self._Colour.B = tonumber(B) or 255
551 self._Colour.G = tonumber(G) or 255
552 self._Colour.A = tonumber(A) or 255
553 else
554 return self._Colour
555 end
556 end
557
558 function UIResRectangle:Draw()
559 local Position = self:Position()
560 local Size = self:Size()
561 Size.Width, Size.Height = FormatXWYH(Size.Width, Size.Height)
562 Position.X, Position.Y = FormatXWYH(Position.X, Position.Y)
563 DrawRect(Position.X + Size.Width * 0.5, Position.Y + Size.Height * 0.5, Size.Width, Size.Height, self._Colour.R, self._Colour.G,
564 self._Colour.B, self._Colour.A)
565 end
566end
567
568--==================================================================================================================================================--
569--[[ NativeUI\UIElements\UIResText ]]
570--==================================================================================================================================================--
571UIResText = setmetatable({}, UIResText)
572UIResText.__index = UIResText
573UIResText.__call = function() return "Text" end
574do
575 function GetCharacterCount(str)
576 local characters = 0
577 for c in str:gmatch("[%z\1-\127\194-\244][\128-\191]*") do
578 local a = c:byte(1, -1)
579 if a ~= nil then characters = characters + 1 end
580 end
581 return characters
582 end
583
584 function GetByteCount(str)
585 local bytes = 0
586 for c in str:gmatch("[%z\1-\127\194-\244][\128-\191]*") do
587 local a, b, c, d = c:byte(1, -1)
588 if a ~= nil then bytes = bytes + 1 end
589 if b ~= nil then bytes = bytes + 1 end
590 if c ~= nil then bytes = bytes + 1 end
591 if d ~= nil then bytes = bytes + 1 end
592 end
593 return bytes
594 end
595
596 function AddLongStringForAscii(str)
597 local maxByteLengthPerString = 99
598 for i = 1, GetCharacterCount(str), maxByteLengthPerString do
599 AddTextComponentString(string.sub(str, i, i + maxByteLengthPerString))
600 end
601 end
602
603 function AddLongStringForUtf8(str)
604 local maxByteLengthPerString = 99
605 local bytecount = GetByteCount(str)
606 local charcount = GetCharacterCount(str)
607 if bytecount < maxByteLengthPerString then
608 AddTextComponentString(str)
609 return
610 end
611 local startIndex = 0
612 for i = 0, charcount, 1 do
613 local length = i - startIndex
614 if GetByteCount(string.sub(str, startIndex, length)) > maxByteLengthPerString then
615 AddTextComponentString(string.sub(str, startIndex, length - 1))
616 i = i - 1
617 startIndex = startIndex + (length - 1)
618 end
619 end
620 AddTextComponentString(string.sub(str, startIndex, charcount - startIndex))
621 end
622
623 function AddLongString(str)
624 local bytecount = GetByteCount(str)
625 if bytecount == GetCharacterCount(str) then
626 AddLongStringForAscii(str)
627 else
628 AddLongStringForUtf8(str)
629 end
630 end
631
632 function MeasureStringWidthNoConvert(str, font, scale)
633 SetTextEntryForWidth("STRING")
634 AddLongString(str)
635 SetTextFont(font or 0)
636 SetTextScale(1.0, scale or 0)
637 if EndTextCommandGetWidth ~= nil then
638 return EndTextCommandGetWidth(true)
639 else
640 return GetTextScreenWidth(true)
641 end
642 end
643
644 function MeasureStringWidth(str, font, scale)
645 local W, H = GetResolution()
646 return MeasureStringWidthNoConvert(str, font, scale) * W
647 end
648
649 function UIResText.New(Text, X, Y, Scale, R, G, B, A, Font, Alignment, DropShadow, Outline, WordWrap, LongText)
650 local _UIResText = {
651 _Text = tostring(Text) or "",
652 X = tonumber(X) or 0,
653 Y = tonumber(Y) or 0,
654 Scale = tonumber(Scale) or 0,
655 _Colour = {R = tonumber(R) or 255, G = tonumber(G) or 255, B = tonumber(B) or 255, A = tonumber(A) or 255},
656 Font = tonumber(Font) or 0,
657 Alignment = Alignment or nil,
658 DropShadow = DropShadow or nil,
659 Outline = Outline or nil,
660 WordWrap = tonumber(WordWrap) or 0,
661 LongText = ToBool(LongText) or false
662 }
663 return setmetatable(_UIResText, UIResText)
664 end
665
666 function UIResText:Position(X, Y)
667 if tonumber(X) and tonumber(Y) then
668 self.X = tonumber(X)
669 self.Y = tonumber(Y)
670 else
671 return {X = self.X, Y = self.Y}
672 end
673 end
674
675 function UIResText:Colour(R, G, B, A)
676 if tonumber(R) and tonumber(G) and tonumber(B) and tonumber(A) then
677 self._Colour.R = tonumber(R)
678 self._Colour.B = tonumber(B)
679 self._Colour.G = tonumber(G)
680 self._Colour.A = tonumber(A)
681 else
682 return self._Colour
683 end
684 end
685
686 function UIResText:Text(Text)
687 if tostring(Text) and Text ~= nil then
688 self._Text = tostring(Text)
689 else
690 return self._Text
691 end
692 end
693
694 function UIResText:Draw()
695 local Position = self:Position()
696 Position.X, Position.Y = FormatXWYH(Position.X, Position.Y)
697
698 SetTextFont(self.Font)
699 SetTextScale(1.0, self.Scale)
700 SetTextColour(self._Colour.R, self._Colour.G, self._Colour.B, self._Colour.A)
701
702 if self.DropShadow then SetTextDropShadow() end
703 if self.Outline then SetTextOutline() end
704
705 if self.Alignment ~= nil then
706 if self.Alignment == 1 or self.Alignment == "Center" or self.Alignment == "Centre" then
707 SetTextCentre(true)
708 elseif self.Alignment == 2 or self.Alignment == "Right" then
709 SetTextRightJustify(true)
710 SetTextWrap(0, Position.X)
711 end
712 end
713
714 if tonumber(self.WordWrap) then
715 if tonumber(self.WordWrap) ~= 0 then
716 SetTextWrap(Position.X, Position.X + (tonumber(self.WordWrap) / Resolution.Width))
717 end
718 end
719
720 if BeginTextCommandDisplayText ~= nil then
721 BeginTextCommandDisplayText(self.LongText and "CELL_EMAIL_BCON" or "STRING");
722 else
723 SetTextEntry(self.LongText and "CELL_EMAIL_BCON" or "STRING");
724 end
725 AddLongString(self._Text)
726
727 if EndTextCommandDisplayText ~= nil then
728 EndTextCommandDisplayText(Position.X, Position.Y)
729 else
730 DrawText(Position.X, Position.Y)
731 end
732 end
733end
734
735
736--==================================================================================================================================================--
737--[[ NativeUI\UIElements\Sprite ]]
738--==================================================================================================================================================--
739Sprite = setmetatable({}, Sprite)
740Sprite.__index = Sprite
741Sprite.__call = function() return "Sprite" end
742do
743 function Sprite.New(TxtDictionary, TxtName, X, Y, Width, Height, Heading, R, G, B, A)
744 local _Sprite = {
745 TxtDictionary = tostring(TxtDictionary),
746 TxtName = tostring(TxtName),
747 X = tonumber(X) or 0,
748 Y = tonumber(Y) or 0,
749 Width = tonumber(Width) or 0,
750 Height = tonumber(Height) or 0,
751 Heading = tonumber(Heading) or 0,
752 _Colour = {R = tonumber(R) or 255, G = tonumber(G) or 255, B = tonumber(B) or 255, A = tonumber(A) or 255}
753 }
754 return setmetatable(_Sprite, Sprite)
755 end
756
757 function Sprite:Position(X, Y)
758 if tonumber(X) and tonumber(Y) then
759 self.X = tonumber(X)
760 self.Y = tonumber(Y)
761 else
762 return {X = self.X, Y = self.Y}
763 end
764 end
765
766 function Sprite:Size(Width, Height)
767 if tonumber(Width) and tonumber(Width) then
768 self.Width = tonumber(Width)
769 self.Height = tonumber(Height)
770 else
771 return {Width = self.Width, Height = self.Height}
772 end
773 end
774
775 function Sprite:Colour(R, G, B, A)
776 if tonumber(R) or tonumber(G) or tonumber(B) or tonumber(A) then
777 self._Colour.R = tonumber(R) or 255
778 self._Colour.B = tonumber(B) or 255
779 self._Colour.G = tonumber(G) or 255
780 self._Colour.A = tonumber(A) or 255
781 else
782 return self._Colour
783 end
784 end
785
786 function Sprite:Draw()
787 if not HasStreamedTextureDictLoaded(self.TxtDictionary) then RequestStreamedTextureDict(self.TxtDictionary, true) end
788 local Position = self:Position()
789 local Size = self:Size()
790 Size.Width, Size.Height = FormatXWYH(Size.Width, Size.Height)
791 Position.X, Position.Y = FormatXWYH(Position.X, Position.Y)
792 DrawSprite(self.TxtDictionary, self.TxtName, Position.X + Size.Width * 0.5, Position.Y + Size.Height * 0.5, Size.Width, Size.Height,
793 self.Heading, self._Colour.R, self._Colour.G, self._Colour.B, self._Colour.A)
794 end
795end
796
797--==================================================================================================================================================--
798--[[ NativeUI\UIMenu\elements\Badge ]]
799--==================================================================================================================================================--
800BadgeStyle = {
801 None = 0,
802 BronzeMedal = 1,
803 GoldMedal = 2,
804 SilverMedal = 3,
805 Alert = 4,
806 Crown = 5,
807 Ammo = 6,
808 Armour = 7,
809 Barber = 8,
810 Clothes = 9,
811 Franklin = 10,
812 Bike = 11,
813 Car = 12,
814 Gun = 13,
815 Heart = 14,
816 Makeup = 15,
817 Mask = 16,
818 Michael = 17,
819 Star = 18,
820 Tattoo = 19,
821 Trevor = 20,
822 Lock = 21,
823 Tick = 22,
824 Sale = 23,
825 ArrowLeft = 24,
826 ArrowRight = 25,
827 Audio1 = 26,
828 Audio2 = 27,
829 Audio3 = 28,
830 AudioInactive = 29,
831 AudioMute = 30,
832 Info = 31,
833 MenuArrow = 32,
834 GTAV = 33
835}
836BadgeTexture = {
837 [0] = function() return "" end,
838 [1] = function() return "mp_medal_bronze" end,
839 [2] = function() return "mp_medal_gold" end,
840 [3] = function() return "mp_medal_silver" end,
841 [4] = function() return "mp_alerttriangle" end,
842 [5] = function() return "mp_hostcrown" end,
843 [6] = function(Selected)
844 if Selected then
845 return "shop_ammo_icon_b"
846 else
847 return "shop_ammo_icon_a"
848 end
849 end,
850 [7] = function(Selected)
851 if Selected then
852 return "shop_armour_icon_b"
853 else
854 return "shop_armour_icon_a"
855 end
856 end,
857 [8] = function(Selected)
858 if Selected then
859 return "shop_barber_icon_b"
860 else
861 return "shop_barber_icon_a"
862 end
863 end,
864 [9] = function(Selected)
865 if Selected then
866 return "shop_clothing_icon_b"
867 else
868 return "shop_clothing_icon_a"
869 end
870 end,
871 [10] = function(Selected)
872 if Selected then
873 return "shop_franklin_icon_b"
874 else
875 return "shop_franklin_icon_a"
876 end
877 end,
878 [11] = function(Selected)
879 if Selected then
880 return "shop_garage_bike_icon_b"
881 else
882 return "shop_garage_bike_icon_a"
883 end
884 end,
885 [12] = function(Selected)
886 if Selected then
887 return "shop_garage_icon_b"
888 else
889 return "shop_garage_icon_a"
890 end
891 end,
892 [13] = function(Selected)
893 if Selected then
894 return "shop_gunclub_icon_b"
895 else
896 return "shop_gunclub_icon_a"
897 end
898 end,
899 [14] = function(Selected)
900 if Selected then
901 return "shop_health_icon_b"
902 else
903 return "shop_health_icon_a"
904 end
905 end,
906 [15] = function(Selected)
907 if Selected then
908 return "shop_makeup_icon_b"
909 else
910 return "shop_makeup_icon_a"
911 end
912 end,
913 [16] = function(Selected)
914 if Selected then
915 return "shop_mask_icon_b"
916 else
917 return "shop_mask_icon_a"
918 end
919 end,
920 [17] = function(Selected)
921 if Selected then
922 return "shop_michael_icon_b"
923 else
924 return "shop_michael_icon_a"
925 end
926 end,
927 [18] = function() return "shop_new_star" end,
928 [19] = function(Selected)
929 if Selected then
930 return "shop_tattoos_icon_b"
931 else
932 return "shop_tattoos_icon_a"
933 end
934 end,
935 [20] = function(Selected)
936 if Selected then
937 return "shop_trevor_icon_b"
938 else
939 return "shop_trevor_icon_a"
940 end
941 end,
942 [21] = function() return "shop_lock" end,
943 [22] = function() return "shop_tick_icon" end,
944 [23] = function() return "saleicon" end,
945 [24] = function() return "arrowleft" end,
946 [25] = function() return "arrowright" end,
947 [26] = function() return "leaderboard_audio_1" end,
948 [27] = function() return "leaderboard_audio_2" end,
949 [28] = function() return "leaderboard_audio_3" end,
950 [29] = function() return "leaderboard_audio_inactive" end,
951 [30] = function() return "leaderboard_audio_mute" end,
952 [31] = function() return "info_icon_32" end,
953 [32] = function() return "menuarrow_32" end,
954 [33] = function() return "mpgroundlogo_bikers" end
955}
956BadgeDictionary = {
957 [0] = function(Selected)
958 if Selected then
959 return "commonmenu"
960 else
961 return "commonmenu"
962 end
963 end,
964 [31] = function(Selected)
965 if Selected then
966 return "shared"
967 else
968 return "shared"
969 end
970 end,
971 [32] = function(Selected)
972 if Selected then
973 return "shared"
974 else
975 return "shared"
976 end
977 end,
978 [33] = function(Selected)
979 if Selected then
980 return "3dtextures"
981 else
982 return "3dtextures"
983 end
984 end
985}
986BadgeColour = {
987 [5] = function(Selected)
988 if Selected then
989 return 0, 0, 0, 255
990 else
991 return 255, 255, 255, 255
992 end
993 end,
994 [21] = function(Selected)
995 if Selected then
996 return 0, 0, 0, 255
997 else
998 return 255, 255, 255, 255
999 end
1000 end,
1001 [22] = function(Selected)
1002 if Selected then
1003 return 0, 0, 0, 255
1004 else
1005 return 255, 255, 255, 255
1006 end
1007 end
1008}
1009do
1010 function GetBadgeTexture(Badge, Selected)
1011 if BadgeTexture[Badge] then
1012 return BadgeTexture[Badge](Selected)
1013 else
1014 return ""
1015 end
1016 end
1017
1018 function GetBadgeDictionary(Badge, Selected)
1019 if BadgeDictionary[Badge] then
1020 return BadgeDictionary[Badge](Selected)
1021 else
1022 return "commonmenu"
1023 end
1024 end
1025
1026 function GetBadgeColour(Badge, Selected)
1027 if BadgeColour[Badge] then
1028 return BadgeColour[Badge](Selected)
1029 else
1030 return 255, 255, 255, 255
1031 end
1032 end
1033end
1034
1035--==================================================================================================================================================--
1036--[[ NativeUI\UIMenu\elements\Colours ]]
1037--==================================================================================================================================================--
1038Colours = {
1039 DefaultColors = { R = 0, G = 0, B = 0, A = 0 },
1040 PureWhite = { R = 255, G = 255, B = 255, A = 255 },
1041 White = { R = 240, G = 240, B = 240, A = 255 },
1042 Black = { R = 0, G = 0, B = 0, A = 255 },
1043 Grey = { R = 155, G = 155, B = 155, A = 255 },
1044 GreyLight = { R = 205, G = 205, B = 205, A = 255 },
1045 GreyDark = { R = 77, G = 77, B = 77, A = 255 },
1046 Red = { R = 224, G = 50, B = 50, A = 255 },
1047 RedLight = { R = 240, G = 153, B = 153, A = 255 },
1048 RedDark = { R = 112, G = 25, B = 25, A = 255 },
1049 Blue = { R = 93, G = 182, B = 229, A = 255 },
1050 BlueLight = { R = 174, G = 219, B = 242, A = 255 },
1051 BlueDark = { R = 47, G = 92, B = 115, A = 255 },
1052 Yellow = { R = 240, G = 200, B = 80, A = 255 },
1053 YellowLight = { R = 254, G = 235, B = 169, A = 255 },
1054 YellowDark = { R = 126, G = 107, B = 41, A = 255 },
1055 Orange = { R = 255, G = 133, B = 85, A = 255 },
1056 OrangeLight = { R = 255, G = 194, B = 170, A = 255 },
1057 OrangeDark = { R = 127, G = 66, B = 42, A = 255 },
1058 Green = { R = 114, G = 204, B = 114, A = 255 },
1059 GreenLight = { R = 185, G = 230, B = 185, A = 255 },
1060 GreenDark = { R = 57, G = 102, B = 57, A = 255 },
1061 Purple = { R = 132, G = 102, B = 226, A = 255 },
1062 PurpleLight = { R = 192, G = 179, B = 239, A = 255 },
1063 PurpleDark = { R = 67, G = 57, B = 111, A = 255 },
1064 Pink = { R = 203, G = 54, B = 148, A = 255 },
1065 RadarHealth = { R = 53, G = 154, B = 71, A = 255 },
1066 RadarArmour = { R = 93, G = 182, B = 229, A = 255 },
1067 RadarDamage = { R = 235, G = 36, B = 39, A = 255 },
1068 NetPlayer1 = { R = 194, G = 80, B = 80, A = 255 },
1069 NetPlayer2 = { R = 156, G = 110, B = 175, A = 255 },
1070 NetPlayer3 = { R = 255, G = 123, B = 196, A = 255 },
1071 NetPlayer4 = { R = 247, G = 159, B = 123, A = 255 },
1072 NetPlayer5 = { R = 178, G = 144, B = 132, A = 255 },
1073 NetPlayer6 = { R = 141, G = 206, B = 167, A = 255 },
1074 NetPlayer7 = { R = 113, G = 169, B = 175, A = 255 },
1075 NetPlayer8 = { R = 211, G = 209, B = 231, A = 255 },
1076 NetPlayer9 = { R = 144, G = 127, B = 153, A = 255 },
1077 NetPlayer10 = { R = 106, G = 196, B = 191, A = 255 },
1078 NetPlayer11 = { R = 214, G = 196, B = 153, A = 255 },
1079 NetPlayer12 = { R = 234, G = 142, B = 80, A = 255 },
1080 NetPlayer13 = { R = 152, G = 203, B = 234, A = 255 },
1081 NetPlayer14 = { R = 178, G = 98, B = 135, A = 255 },
1082 NetPlayer15 = { R = 144, G = 142, B = 122, A = 255 },
1083 NetPlayer16 = { R = 166, G = 117, B = 94, A = 255 },
1084 NetPlayer17 = { R = 175, G = 168, B = 168, A = 255 },
1085 NetPlayer18 = { R = 232, G = 142, B = 155, A = 255 },
1086 NetPlayer19 = { R = 187, G = 214, B = 91, A = 255 },
1087 NetPlayer20 = { R = 12, G = 123, B = 86, A = 255 },
1088 NetPlayer21 = { R = 123, G = 196, B = 255, A = 255 },
1089 NetPlayer22 = { R = 171, G = 60, B = 230, A = 255 },
1090 NetPlayer23 = { R = 206, G = 169, B = 13, A = 255 },
1091 NetPlayer24 = { R = 71, G = 99, B = 173, A = 255 },
1092 NetPlayer25 = { R = 42, G = 166, B = 185, A = 255 },
1093 NetPlayer26 = { R = 186, G = 157, B = 125, A = 255 },
1094 NetPlayer27 = { R = 201, G = 225, B = 255, A = 255 },
1095 NetPlayer28 = { R = 240, G = 240, B = 150, A = 255 },
1096 NetPlayer29 = { R = 237, G = 140, B = 161, A = 255 },
1097 NetPlayer30 = { R = 249, G = 138, B = 138, A = 255 },
1098 NetPlayer31 = { R = 252, G = 239, B = 166, A = 255 },
1099 NetPlayer32 = { R = 240, G = 240, B = 240, A = 255 },
1100 SimpleBlipDefault = { R = 159, G = 201, B = 166, A = 255 },
1101 MenuBlue = { R = 140, G = 140, B = 140, A = 255 },
1102 MenuGreyLight = { R = 140, G = 140, B = 140, A = 255 },
1103 MenuBlueExtraDark = { R = 40, G = 40, B = 40, A = 255 },
1104 MenuYellow = { R = 240, G = 160, B = 0, A = 255 },
1105 MenuYellowDark = { R = 240, G = 160, B = 0, A = 255 },
1106 MenuGreen = { R = 240, G = 160, B = 0, A = 255 },
1107 MenuGrey = { R = 140, G = 140, B = 140, A = 255 },
1108 MenuGreyDark = { R = 60, G = 60, B = 60, A = 255 },
1109 MenuHighlight = { R = 30, G = 30, B = 30, A = 255 },
1110 MenuStandard = { R = 140, G = 140, B = 140, A = 255 },
1111 MenuDimmed = { R = 75, G = 75, B = 75, A = 255 },
1112 MenuExtraDimmed = { R = 50, G = 50, B = 50, A = 255 },
1113 BriefTitle = { R = 95, G = 95, B = 95, A = 255 },
1114 MidGreyMp = { R = 100, G = 100, B = 100, A = 255 },
1115 NetPlayer1Dark = { R = 93, G = 39, B = 39, A = 255 },
1116 NetPlayer2Dark = { R = 77, G = 55, B = 89, A = 255 },
1117 NetPlayer3Dark = { R = 124, G = 62, B = 99, A = 255 },
1118 NetPlayer4Dark = { R = 120, G = 80, B = 80, A = 255 },
1119 NetPlayer5Dark = { R = 87, G = 72, B = 66, A = 255 },
1120 NetPlayer6Dark = { R = 74, G = 103, B = 83, A = 255 },
1121 NetPlayer7Dark = { R = 60, G = 85, B = 88, A = 255 },
1122 NetPlayer8Dark = { R = 105, G = 105, B = 64, A = 255 },
1123 NetPlayer9Dark = { R = 72, G = 63, B = 76, A = 255 },
1124 NetPlayer10Dark = { R = 53, G = 98, B = 95, A = 255 },
1125 NetPlayer11Dark = { R = 107, G = 98, B = 76, A = 255 },
1126 NetPlayer12Dark = { R = 117, G = 71, B = 40, A = 255 },
1127 NetPlayer13Dark = { R = 76, G = 101, B = 117, A = 255 },
1128 NetPlayer14Dark = { R = 65, G = 35, B = 47, A = 255 },
1129 NetPlayer15Dark = { R = 72, G = 71, B = 61, A = 255 },
1130 NetPlayer16Dark = { R = 85, G = 58, B = 47, A = 255 },
1131 NetPlayer17Dark = { R = 87, G = 84, B = 84, A = 255 },
1132 NetPlayer18Dark = { R = 116, G = 71, B = 77, A = 255 },
1133 NetPlayer19Dark = { R = 93, G = 107, B = 45, A = 255 },
1134 NetPlayer20Dark = { R = 6, G = 61, B = 43, A = 255 },
1135 NetPlayer21Dark = { R = 61, G = 98, B = 127, A = 255 },
1136 NetPlayer22Dark = { R = 85, G = 30, B = 115, A = 255 },
1137 NetPlayer23Dark = { R = 103, G = 84, B = 6, A = 255 },
1138 NetPlayer24Dark = { R = 35, G = 49, B = 86, A = 255 },
1139 NetPlayer25Dark = { R = 21, G = 83, B = 92, A = 255 },
1140 NetPlayer26Dark = { R = 93, G = 98, B = 62, A = 255 },
1141 NetPlayer27Dark = { R = 100, G = 112, B = 127, A = 255 },
1142 NetPlayer28Dark = { R = 120, G = 120, B = 75, A = 255 },
1143 NetPlayer29Dark = { R = 152, G = 76, B = 93, A = 255 },
1144 NetPlayer30Dark = { R = 124, G = 69, B = 69, A = 255 },
1145 NetPlayer31Dark = { R = 10, G = 43, B = 50, A = 255 },
1146 NetPlayer32Dark = { R = 95, G = 95, B = 10, A = 255 },
1147 Bronze = { R = 180, G = 130, B = 97, A = 255 },
1148 Silver = { R = 150, G = 153, B = 161, A = 255 },
1149 Gold = { R = 214, G = 181, B = 99, A = 255 },
1150 Platinum = { R = 166, G = 221, B = 190, A = 255 },
1151 Gang1 = { R = 29, G = 100, B = 153, A = 255 },
1152 Gang2 = { R = 214, G = 116, B = 15, A = 255 },
1153 Gang3 = { R = 135, G = 125, B = 142, A = 255 },
1154 Gang4 = { R = 229, G = 119, B = 185, A = 255 },
1155 SameCrew = { R = 252, G = 239, B = 166, A = 255 },
1156 Freemode = { R = 45, G = 110, B = 185, A = 255 },
1157 PauseBg = { R = 0, G = 0, B = 0, A = 255 },
1158 Friendly = { R = 93, G = 182, B = 229, A = 255 },
1159 Enemy = { R = 194, G = 80, B = 80, A = 255 },
1160 Location = { R = 240, G = 200, B = 80, A = 255 },
1161 Pickup = { R = 114, G = 204, B = 114, A = 255 },
1162 PauseSingleplayer = { R = 114, G = 204, B = 114, A = 255 },
1163 FreemodeDark = { R = 22, G = 55, B = 92, A = 255 },
1164 InactiveMission = { R = 154, G = 154, B = 154, A = 255 },
1165 Damage = { R = 194, G = 80, B = 80, A = 255 },
1166 PinkLight = { R = 252, G = 115, B = 201, A = 255 },
1167 PmMitemHighlight = { R = 252, G = 177, B = 49, A = 255 },
1168 ScriptVariable = { R = 0, G = 0, B = 0, A = 255 },
1169 Yoga = { R = 109, G = 247, B = 204, A = 255 },
1170 Tennis = { R = 241, G = 101, B = 34, A = 255 },
1171 Golf = { R = 214, G = 189, B = 97, A = 255 },
1172 ShootingRange = { R = 112, G = 25, B = 25, A = 255 },
1173 FlightSchool = { R = 47, G = 92, B = 115, A = 255 },
1174 NorthBlue = { R = 93, G = 182, B = 229, A = 255 },
1175 SocialClub = { R = 234, G = 153, B = 28, A = 255 },
1176 PlatformBlue = { R = 11, G = 55, B = 123, A = 255 },
1177 PlatformGreen = { R = 146, G = 200, B = 62, A = 255 },
1178 PlatformGrey = { R = 234, G = 153, B = 28, A = 255 },
1179 FacebookBlue = { R = 66, G = 89, B = 148, A = 255 },
1180 IngameBg = { R = 0, G = 0, B = 0, A = 255 },
1181 Darts = { R = 114, G = 204, B = 114, A = 255 },
1182 Waypoint = { R = 164, G = 76, B = 242, A = 255 },
1183 Michael = { R = 101, G = 180, B = 212, A = 255 },
1184 Franklin = { R = 171, G = 237, B = 171, A = 255 },
1185 Trevor = { R = 255, G = 163, B = 87, A = 255 },
1186 GolfP1 = { R = 240, G = 240, B = 240, A = 255 },
1187 GolfP2 = { R = 235, G = 239, B = 30, A = 255 },
1188 GolfP3 = { R = 255, G = 149, B = 14, A = 255 },
1189 GolfP4 = { R = 246, G = 60, B = 161, A = 255 },
1190 WaypointLight = { R = 210, G = 166, B = 249, A = 255 },
1191 WaypointDark = { R = 82, G = 38, B = 121, A = 255 },
1192 PanelLight = { R = 0, G = 0, B = 0, A = 255 },
1193 MichaelDark = { R = 72, G = 103, B = 116, A = 255 },
1194 FranklinDark = { R = 85, G = 118, B = 85, A = 255 },
1195 TrevorDark = { R = 127, G = 81, B = 43, A = 255 },
1196 ObjectiveRoute = { R = 240, G = 200, B = 80, A = 255 },
1197 PausemapTint = { R = 0, G = 0, B = 0, A = 255 },
1198 PauseDeselect = { R = 100, G = 100, B = 100, A = 255 },
1199 PmWeaponsPurchasable = { R = 45, G = 110, B = 185, A = 255 },
1200 PmWeaponsLocked = { R = 240, G = 240, B = 240, A = 255 },
1201 EndScreenBg = { R = 0, G = 0, B = 0, A = 255 },
1202 Chop = { R = 224, G = 50, B = 50, A = 255 },
1203 PausemapTintHalf = { R = 0, G = 0, B = 0, A = 255 },
1204 NorthBlueOfficial = { R = 0, G = 71, B = 133, A = 255 },
1205 ScriptVariable2 = { R = 0, G = 0, B = 0, A = 255 },
1206 H = { R = 33, G = 118, B = 37, A = 255 },
1207 HDark = { R = 37, G = 102, B = 40, A = 255 },
1208 T = { R = 234, G = 153, B = 28, A = 255 },
1209 TDark = { R = 225, G = 140, B = 8, A = 255 },
1210 HShard = { R = 20, G = 40, B = 0, A = 255 },
1211 ControllerMichael = { R = 48, G = 255, B = 255, A = 255 },
1212 ControllerFranklin = { R = 48, G = 255, B = 0, A = 255 },
1213 ControllerTrevor = { R = 176, G = 80, B = 0, A = 255 },
1214 ControllerChop = { R = 127, G = 0, B = 0, A = 255 },
1215 VideoEditorVideo = { R = 53, G = 166, B = 224, A = 255 },
1216 VideoEditorAudio = { R = 162, G = 79, B = 157, A = 255 },
1217 VideoEditorText = { R = 104, G = 192, B = 141, A = 255 },
1218 HbBlue = { R = 29, G = 100, B = 153, A = 255 },
1219 HbYellow = { R = 234, G = 153, B = 28, A = 255 },
1220 VideoEditorScore = { R = 240, G = 160, B = 1, A = 255 },
1221 VideoEditorAudioFadeout = { R = 59, G = 34, B = 57, A = 255 },
1222 VideoEditorTextFadeout = { R = 41, G = 68, B = 53, A = 255 },
1223 VideoEditorScoreFadeout = { R = 82, G = 58, B = 10, A = 255 },
1224 HeistBackground = { R = 37, G = 102, B = 40, A = 255 },
1225 VideoEditorAmbient = { R = 240, G = 200, B = 80, A = 255 },
1226 VideoEditorAmbientFadeout = { R = 80, G = 70, B = 34, A = 255 },
1227 Gb = { R = 255, G = 133, B = 85, A = 255 },
1228 G = { R = 255, G = 194, B = 170, A = 255 },
1229 B = { R = 255, G = 133, B = 85, A = 255 },
1230 LowFlow = { R = 240, G = 200, B = 80, A = 255 },
1231 LowFlowDark = { R = 126, G = 107, B = 41, A = 255 },
1232 G1 = { R = 247, G = 159, B = 123, A = 255 },
1233 G2 = { R = 226, G = 134, B = 187, A = 255 },
1234 G3 = { R = 239, G = 238, B = 151, A = 255 },
1235 G4 = { R = 113, G = 169, B = 175, A = 255 },
1236 G5 = { R = 160, G = 140, B = 193, A = 255 },
1237 G6 = { R = 141, G = 206, B = 167, A = 255 },
1238 G7 = { R = 181, G = 214, B = 234, A = 255 },
1239 G8 = { R = 178, G = 144, B = 132, A = 255 },
1240 G9 = { R = 0, G = 132, B = 114, A = 255 },
1241 G10 = { R = 216, G = 85, B = 117, A = 255 },
1242 G11 = { R = 30, G = 100, B = 152, A = 255 },
1243 G12 = { R = 43, G = 181, B = 117, A = 255 },
1244 G13 = { R = 233, G = 141, B = 79, A = 255 },
1245 G14 = { R = 137, G = 210, B = 215, A = 255 },
1246 G15 = { R = 134, G = 125, B = 141, A = 255 },
1247 Adversary = { R = 109, G = 34, B = 33, A = 255 },
1248 DegenRed = { R = 255, G = 0, B = 0, A = 255 },
1249 DegenYellow = { R = 255, G = 255, B = 0, A = 255 },
1250 DegenGreen = { R = 0, G = 255, B = 0, A = 255 },
1251 DegenCyan = { R = 0, G = 255, B = 255, A = 255 },
1252 DegenBlue = { R = 0, G = 0, B = 255, A = 255 },
1253 DegenMagenta = { R = 255, G = 0, B = 255, A = 255 },
1254 Stunt1 = { R = 38, G = 136, B = 234, A = 255 },
1255 Stunt2 = { R = 224, G = 50, B = 50, A = 255 },
1256}
1257
1258--==================================================================================================================================================--
1259--[[ NativeUI\UIMenu\elements\ColoursPanel ]]
1260--==================================================================================================================================================--
1261ColoursPanel = {}
1262ColoursPanel.HairCut = {
1263 {22, 19, 19}, -- 0
1264 {30, 28, 25}, -- 1
1265 {76, 56, 45}, -- 2
1266 {69, 34, 24}, -- 3
1267 {123, 59, 31}, -- 4
1268 {149, 68, 35}, -- 5
1269 {165, 87, 50}, -- 6
1270 {175, 111, 72}, -- 7
1271 {159, 105, 68}, -- 8
1272 {198, 152, 108}, -- 9
1273 {213, 170, 115}, -- 10
1274 {223, 187, 132}, -- 11
1275 {202, 164, 110}, -- 12
1276 {238, 204, 130}, -- 13
1277 {229, 190, 126}, -- 14
1278 {250, 225, 167}, -- 15
1279 {187, 140, 96}, -- 16
1280 {163, 92, 60}, -- 17
1281 {144, 52, 37}, -- 18
1282 {134, 21, 17}, -- 19
1283 {164, 24, 18}, -- 20
1284 {195, 33, 24}, -- 21
1285 {221, 69, 34}, -- 22
1286 {229, 71, 30}, -- 23
1287 {208, 97, 56}, -- 24
1288 {113, 79, 38}, -- 25
1289 {132, 107, 95}, -- 26
1290 {185, 164, 150}, -- 27
1291 {218, 196, 180}, -- 28
1292 {247, 230, 217}, -- 29
1293 {102, 72, 93}, -- 30
1294 {162, 105, 138}, -- 31
1295 {171, 174, 11}, -- 32
1296 {239, 61, 200}, -- 33
1297 {255, 69, 152}, -- 34
1298 {255, 178, 191}, -- 35
1299 {12, 168, 146}, -- 36
1300 {8, 146, 165}, -- 37
1301 {11, 82, 134}, -- 38
1302 {118, 190, 117}, -- 39
1303 {52, 156, 104}, -- 40
1304 {22, 86, 85}, -- 41
1305 {152, 177, 40}, -- 42
1306 {127, 162, 23}, -- 43
1307 {241, 200, 98}, -- 44
1308 {238, 178, 16}, -- 45
1309 {224, 134, 14}, -- 46
1310 {247, 157, 15}, -- 47
1311 {243, 143, 16}, -- 48
1312 {231, 70, 15}, -- 49
1313 {255, 101, 21}, -- 50
1314 {254, 91, 34}, -- 51
1315 {252, 67, 21}, -- 52
1316 {196, 12, 15}, -- 53
1317 {143, 10, 14}, -- 54
1318 {44, 27, 22}, -- 55
1319 {80, 51, 37}, -- 56
1320 {98, 54, 37}, -- 57
1321 {60, 31, 24}, -- 58
1322 {69, 43, 32}, -- 59
1323 {8, 10, 14}, -- 60
1324 {212, 185, 158}, -- 61
1325 {212, 185, 158}, -- 62
1326 {213, 170, 115} -- 63
1327}
1328
1329--==================================================================================================================================================--
1330--[[ NativeUI\UIMenu\elements\StringMeasurer ]]
1331--==================================================================================================================================================--
1332CharacterMap = {
1333 [' '] = 6,
1334 ['!'] = 6,
1335 ['"'] = 6,
1336 ['#'] = 11,
1337 ['$'] = 10,
1338 ['%'] = 17,
1339 ['&'] = 13,
1340 ['\\'] = 4,
1341 ['('] = 6,
1342 [')'] = 6,
1343 ['*'] = 7,
1344 ['+'] = 10,
1345 [','] = 4,
1346 ['-'] = 6,
1347 ['.'] = 4,
1348 ['/'] = 7,
1349 ['0'] = 12,
1350 ['1'] = 7,
1351 ['2'] = 11,
1352 ['3'] = 11,
1353 ['4'] = 11,
1354 ['5'] = 11,
1355 ['6'] = 12,
1356 ['7'] = 10,
1357 ['8'] = 11,
1358 ['9'] = 11,
1359 [':'] = 5,
1360 [';'] = 4,
1361 ['<'] = 9,
1362 ['='] = 9,
1363 ['>'] = 9,
1364 ['?'] = 10,
1365 ['@'] = 15,
1366 ['A'] = 12,
1367 ['B'] = 13,
1368 ['C'] = 14,
1369 ['D'] = 14,
1370 ['E'] = 12,
1371 ['F'] = 12,
1372 ['G'] = 15,
1373 ['H'] = 14,
1374 ['I'] = 5,
1375 ['J'] = 11,
1376 ['K'] = 13,
1377 ['L'] = 11,
1378 ['M'] = 16,
1379 ['N'] = 14,
1380 ['O'] = 16,
1381 ['P'] = 12,
1382 ['Q'] = 15,
1383 ['R'] = 13,
1384 ['S'] = 12,
1385 ['T'] = 11,
1386 ['U'] = 13,
1387 ['V'] = 12,
1388 ['W'] = 18,
1389 ['X'] = 11,
1390 ['Y'] = 11,
1391 ['Z'] = 12,
1392 ['['] = 6,
1393 [']'] = 6,
1394 ['^'] = 9,
1395 ['_'] = 18,
1396 ['`'] = 8,
1397 ['a'] = 11,
1398 ['b'] = 12,
1399 ['c'] = 11,
1400 ['d'] = 12,
1401 ['e'] = 12,
1402 ['f'] = 5,
1403 ['g'] = 13,
1404 ['h'] = 11,
1405 ['i'] = 4,
1406 ['j'] = 4,
1407 ['k'] = 10,
1408 ['l'] = 4,
1409 ['m'] = 18,
1410 ['n'] = 11,
1411 ['o'] = 12,
1412 ['p'] = 12,
1413 ['q'] = 12,
1414 ['r'] = 7,
1415 ['s'] = 9,
1416 ['t'] = 5,
1417 ['u'] = 11,
1418 ['v'] = 10,
1419 ['w'] = 14,
1420 ['x'] = 9,
1421 ['y'] = 10,
1422 ['z'] = 9,
1423 ['{'] = 6,
1424 ['|'] = 3,
1425 ['}'] = 6
1426}
1427function MeasureString(str)
1428 local output = 0
1429 for i = 1, GetCharacterCount(str), 1 do
1430 if CharacterMap[string.sub(str, i, i)] then output = output + CharacterMap[string.sub(str, i, i)] + 1 end
1431 end
1432 return output
1433end
1434
1435--==================================================================================================================================================--
1436--[[ NativeUI\UIMenu\items\UIMenuItem ]]
1437--==================================================================================================================================================--
1438UIMenuItem = setmetatable({}, UIMenuItem)
1439UIMenuItem.__index = UIMenuItem
1440UIMenuItem.__call = function() return "UIMenuItem", "UIMenuItem" end
1441do
1442 function UIMenuItem.New(Text, Description)
1443 local _UIMenuItem = {
1444 Rectangle = UIResRectangle.New(0, 0, 431, 38, 255, 255, 255, 20),
1445 Text = UIResText.New(tostring(Text) or "", 8, 0, 0.33, 245, 245, 245, 255, 0),
1446 _Text = {
1447 Padding = {X = 8},
1448 Colour = {Selected = {R = 25, G = 25, B = 25, A = 255}, Hovered = {R = 245, G = 245, B = 245, A = 255}}
1449 },
1450 _Description = tostring(Description) or "",
1451 SelectedSprite = Sprite.New("commonmenu", "gradient_nav", 0, 0, 431, 38, nil, 200, 200, 200, 150),
1452 LeftBadge = {Sprite = Sprite.New("commonmenu", "", 0, 0, 35, 35), Badge = 0},
1453 RightBadge = {Sprite = Sprite.New("commonmenu", "", 0, 0, 35, 35), Badge = 0},
1454 Label = {
1455 Text = UIResText.New("", 0, 0, 0.33, 245, 245, 245, 255, 0, "Right"),
1456 MainColour = {R = 255, G = 255, B = 255, A = 255},
1457 HighlightColour = {R = 0, G = 0, B = 0, A = 255}
1458 },
1459 _Selected = false,
1460 _Hovered = false,
1461 _Enabled = true,
1462 _Offset = {X = 0, Y = 0},
1463 _LabelOffset = {X = 0, Y = 0},
1464 _LeftBadgeOffset = {X = 0, Y = 0},
1465 _RightBadgeOffset = {X = 0, Y = 0},
1466 ParentMenu = nil,
1467 Panels = {},
1468 Activated = function(menu, item) end,
1469 ActivatedPanel = function(menu, item, panel, panelvalue) end
1470 }
1471 return setmetatable(_UIMenuItem, UIMenuItem)
1472 end
1473
1474 function UIMenuItem:SetParentMenu(Menu)
1475 if Menu ~= nil and Menu() == "UIMenu" then
1476 self.ParentMenu = Menu
1477 else
1478 return self.ParentMenu
1479 end
1480 end
1481
1482 function UIMenuItem:Selected(bool)
1483 if bool ~= nil then
1484 self._Selected = ToBool(bool)
1485 else
1486 return self._Selected
1487 end
1488 end
1489
1490 function UIMenuItem:Hovered(bool)
1491 if bool ~= nil then
1492 self._Hovered = ToBool(bool)
1493 else
1494 return self._Hovered
1495 end
1496 end
1497
1498 function UIMenuItem:Enabled(bool)
1499 if bool ~= nil then
1500 self._Enabled = ToBool(bool)
1501 else
1502 return self._Enabled
1503 end
1504 end
1505
1506 function UIMenuItem:Description(str)
1507 if tostring(str) and str ~= nil then
1508 self._Description = tostring(str)
1509 else
1510 return self._Description
1511 end
1512 end
1513
1514 function UIMenuItem:Offset(X, Y)
1515 if tonumber(X) or tonumber(Y) then
1516 if tonumber(X) then self._Offset.X = tonumber(X) end
1517 if tonumber(Y) then self._Offset.Y = tonumber(Y) end
1518 else
1519 return self._Offset
1520 end
1521 end
1522
1523 function UIMenuItem:LeftBadgeOffset(X, Y)
1524 if tonumber(X) or tonumber(Y) then
1525 if tonumber(X) then self._LeftBadgeOffset.X = tonumber(X) end
1526 if tonumber(Y) then self._LeftBadgeOffset.Y = tonumber(Y) end
1527 else
1528 return self._LeftBadgeOffset
1529 end
1530 end
1531
1532 function UIMenuItem:RightBadgeOffset(X, Y)
1533 if tonumber(X) or tonumber(Y) then
1534 if tonumber(X) then self._RightBadgeOffset.X = tonumber(X) end
1535 if tonumber(Y) then self._RightBadgeOffset.Y = tonumber(Y) end
1536 else
1537 return self._RightBadgeOffset
1538 end
1539 end
1540
1541 function UIMenuItem:Position(Y)
1542 if tonumber(Y) then
1543 self.Rectangle:Position(self._Offset.X, Y + 144 + self._Offset.Y)
1544 self.SelectedSprite:Position(0 + self._Offset.X, Y + 144 + self._Offset.Y)
1545 self.Text:Position(self._Text.Padding.X + self._Offset.X, Y + 149 + self._Offset.Y)
1546 self.LeftBadge.Sprite:Position(0 + self._Offset.X + self._LeftBadgeOffset.X, Y + 146 + self._Offset.Y + self._LeftBadgeOffset.Y)
1547 self.RightBadge.Sprite:Position(385 + self._Offset.X + self._RightBadgeOffset.X,
1548 Y + 146 + self._Offset.Y + self._RightBadgeOffset.Y)
1549 self.Label.Text:Position(415 + self._Offset.X + self._LabelOffset.X, Y + 148 + self._Offset.Y + self._LabelOffset.Y)
1550 end
1551 end
1552
1553 function UIMenuItem:RightLabel(Text, MainColour, HighlightColour)
1554 if MainColour ~= nil then
1555 local labelMainColour = MainColour
1556 else
1557 local labelMainColour = {R = 255, G = 255, B = 255, A = 255}
1558 end
1559 if HighlightColour ~= nil then
1560 local labelHighlightColour = HighlightColour
1561 else
1562 local labelHighlightColour = {R = 0, G = 0, B = 0, A = 255}
1563 end
1564 if tostring(Text) and Text ~= nil then
1565 if type(labelMainColour) == "table" then self.Label.MainColour = labelMainColour end
1566 if type(labelHighlightColour) == "table" then self.Label.HighlightColour = labelHighlightColour end
1567 self.Label.Text:Text(tostring(Text))
1568 else
1569 self.Label.MainColour = {R = 0, G = 0, B = 0, A = 0}
1570 self.Label.HighlightColour = {R = 0, G = 0, B = 0, A = 0}
1571 return self.Label.Text:Text()
1572 end
1573 end
1574
1575 function UIMenuItem:SetLeftBadge(Badge) if tonumber(Badge) then self.LeftBadge.Badge = tonumber(Badge) end end
1576
1577 function UIMenuItem:SetRightBadge(Badge) if tonumber(Badge) then self.RightBadge.Badge = tonumber(Badge) end end
1578
1579 function UIMenuItem:Text(Text)
1580 if tostring(Text) and Text ~= nil then
1581 self.Text:Text(tostring(Text))
1582 else
1583 return self.Text:Text()
1584 end
1585 end
1586
1587 function UIMenuItem:SetTextSelectedColor(R, G, B, A)
1588 if tonumber(R) and tonumber(G) and tonumber(B) and tonumber(A) then
1589 self._Text.Colour.Selected.R = R
1590 self._Text.Colour.Selected.G = G
1591 self._Text.Colour.Selected.B = B
1592 self._Text.Colour.Selected.A = A
1593 else
1594 return {
1595 R = self._Text.Colour.Selected.R,
1596 G = self._Text.Colour.Selected.G,
1597 B = self._Text.Colour.Selected.B,
1598 A = self._Text.Colour.Selected.A
1599 }
1600 end
1601 end
1602
1603 function UIMenuItem:SetTextHoveredColor(R, G, B, A)
1604 if tonumber(R) and tonumber(G) and tonumber(B) and tonumber(A) then
1605 self._Text.Colour.Hovered.R = R
1606 self._Text.Colour.Hovered.G = G
1607 self._Text.Colour.Hovered.B = B
1608 self._Text.Colour.Hovered.A = A
1609 else
1610 return {
1611 R = self._Text.Colour.Hovered.R,
1612 G = self._Text.Colour.Hovered.G,
1613 B = self._Text.Colour.Hovered.B,
1614 A = self._Text.Colour.Hovered.A
1615 }
1616 end
1617 end
1618
1619 function UIMenuItem:AddPanel(Panel)
1620 if Panel() == "UIMenuPanel" then
1621 table.insert(self.Panels, Panel)
1622 Panel:SetParentItem(self)
1623 end
1624 end
1625
1626 function UIMenuItem:RemovePanelAt(Index)
1627 if tonumber(Index) then if self.Panels[Index] then table.remove(self.Panels, tonumber(Index)) end end
1628 end
1629
1630 function UIMenuItem:FindPanelIndex(Panel)
1631 if Panel() == "UIMenuPanel" then for Index = 1, #self.Panels do if self.Panels[Index] == Panel then return Index end end end
1632 return nil
1633 end
1634
1635 function UIMenuItem:FindPanelItem()
1636 for Index = #self.Items, 1, -1 do if self.Items[Index].Panel then return Index end end
1637 return nil
1638 end
1639
1640 function UIMenuItem:Draw()
1641 self.Rectangle:Size(431 + self.ParentMenu.WidthOffset, self.Rectangle.Height)
1642 self.SelectedSprite:Size(431 + self.ParentMenu.WidthOffset, self.SelectedSprite.Height)
1643
1644 if self._Hovered and not self._Selected then self.Rectangle:Draw() end
1645
1646 if self._Selected then self.SelectedSprite:Draw() end
1647
1648 if self._Enabled then
1649 if self._Selected then
1650 self.Text:Colour(self._Text.Colour.Selected.R, self._Text.Colour.Selected.G, self._Text.Colour.Selected.B,
1651 self._Text.Colour.Selected.A)
1652 self.Label.Text:Colour(self.Label.HighlightColour.R, self.Label.HighlightColour.G, self.Label.HighlightColour.B,
1653 self.Label.HighlightColour.A)
1654 else
1655 self.Text:Colour(self._Text.Colour.Hovered.R, self._Text.Colour.Hovered.G, self._Text.Colour.Hovered.B,
1656 self._Text.Colour.Hovered.A)
1657 self.Label.Text:Colour(self.Label.MainColour.R, self.Label.MainColour.G, self.Label.MainColour.B, self.Label.MainColour.A)
1658 end
1659 else
1660 self.Text:Colour(163, 159, 148, 255)
1661 self.Label.Text:Colour(163, 159, 148, 255)
1662 end
1663
1664 if self.LeftBadge.Badge == BadgeStyle.None then
1665 self.Text:Position(self._Text.Padding.X + self._Offset.X, self.Text.Y)
1666 else
1667 self.Text:Position(35 + self._Offset.X + self._LeftBadgeOffset.X, self.Text.Y)
1668 self.LeftBadge.Sprite.TxtDictionary = GetBadgeDictionary(self.LeftBadge.Badge, self._Selected)
1669 self.LeftBadge.Sprite.TxtName = GetBadgeTexture(self.LeftBadge.Badge, self._Selected)
1670 self.LeftBadge.Sprite:Colour(GetBadgeColour(self.LeftBadge.Badge, self._Selected))
1671 self.LeftBadge.Sprite:Draw()
1672 end
1673
1674 if self.RightBadge.Badge ~= BadgeStyle.None then
1675 self.RightBadge.Sprite:Position(385 + self._Offset.X + self.ParentMenu.WidthOffset + self._RightBadgeOffset.X,
1676 self.RightBadge.Sprite.Y)
1677 self.RightBadge.Sprite.TxtDictionary = GetBadgeDictionary(self.RightBadge.Badge, self._Selected)
1678 self.RightBadge.Sprite.TxtName = GetBadgeTexture(self.RightBadge.Badge, self._Selected)
1679 self.RightBadge.Sprite:Colour(GetBadgeColour(self.RightBadge.Badge, self._Selected))
1680 self.RightBadge.Sprite:Draw()
1681 end
1682
1683 if self.Label.Text:Text() ~= "" and string.len(self.Label.Text:Text()) > 0 then
1684 if self.RightBadge.Badge ~= BadgeStyle.None then
1685 self.Label.Text:Position(385 + self._Offset.X + self.ParentMenu.WidthOffset + self._RightBadgeOffset.X, self.Label.Text.Y)
1686 self.Label.Text:Draw()
1687 else
1688 self.Label.Text:Position(415 + self._Offset.X + self.ParentMenu.WidthOffset + self._LabelOffset.X, self.Label.Text.Y)
1689 self.Label.Text:Draw()
1690 end
1691 end
1692
1693 self.Text:Draw()
1694 end
1695end
1696
1697--==================================================================================================================================================--
1698--[[ NativeUI\UIMenu\items\UIMenuCheckboxItem ]]
1699--==================================================================================================================================================--
1700UIMenuCheckboxItem = setmetatable({}, UIMenuCheckboxItem)
1701UIMenuCheckboxItem.__index = UIMenuCheckboxItem
1702UIMenuCheckboxItem.__call = function() return "UIMenuItem", "UIMenuCheckboxItem" end
1703do
1704 function UIMenuCheckboxItem.New(Text, Check, Description, CheckboxStyle)
1705 if CheckboxStyle ~= nil then
1706 CheckboxStyle = tonumber(CheckboxStyle)
1707 else
1708 CheckboxStyle = 1
1709 end
1710 local _UIMenuCheckboxItem = {
1711 Base = UIMenuItem.New(Text or "", Description or ""),
1712 CheckboxStyle = CheckboxStyle,
1713 CheckedSprite = Sprite.New("commonmenu", "shop_box_blank", 410, 95, 50, 50),
1714 Checked = ToBool(Check),
1715 CheckboxEvent = function(menu, item, checked) end
1716 }
1717 return setmetatable(_UIMenuCheckboxItem, UIMenuCheckboxItem)
1718 end
1719
1720 function UIMenuCheckboxItem:SetParentMenu(Menu)
1721 if Menu() == "UIMenu" then
1722 self.Base.ParentMenu = Menu
1723 else
1724 return self.Base.ParentMenu
1725 end
1726 end
1727
1728 function UIMenuCheckboxItem:Position(Y)
1729 if tonumber(Y) then
1730 self.Base:Position(Y)
1731 self.CheckedSprite:Position(380 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, Y + 138 + self.Base._Offset.Y)
1732 end
1733 end
1734
1735 function UIMenuCheckboxItem:Selected(bool)
1736 if bool ~= nil then
1737 self.Base._Selected = ToBool(bool)
1738 else
1739 return self.Base._Selected
1740 end
1741 end
1742
1743 function UIMenuCheckboxItem:Hovered(bool)
1744 if bool ~= nil then
1745 self.Base._Hovered = ToBool(bool)
1746 else
1747 return self.Base._Hovered
1748 end
1749 end
1750
1751 function UIMenuCheckboxItem:Enabled(bool)
1752 if bool ~= nil then
1753 self.Base._Enabled = ToBool(bool)
1754 else
1755 return self.Base._Enabled
1756 end
1757 end
1758
1759 function UIMenuCheckboxItem:Description(str)
1760 if tostring(str) and str ~= nil then
1761 self.Base._Description = tostring(str)
1762 else
1763 return self.Base._Description
1764 end
1765 end
1766
1767 function UIMenuCheckboxItem:Offset(X, Y)
1768 if tonumber(X) or tonumber(Y) then
1769 if tonumber(X) then self.Base._Offset.X = tonumber(X) end
1770 if tonumber(Y) then self.Base._Offset.Y = tonumber(Y) end
1771 else
1772 return self.Base._Offset
1773 end
1774 end
1775
1776 function UIMenuCheckboxItem:Text(Text)
1777 if tostring(Text) and Text ~= nil then
1778 self.Base.Text:Text(tostring(Text))
1779 else
1780 return self.Base.Text:Text()
1781 end
1782 end
1783
1784 function UIMenuCheckboxItem:SetLeftBadge() error("This item does not support badges") end
1785
1786 function UIMenuCheckboxItem:SetRightBadge() error("This item does not support badges") end
1787
1788 function UIMenuCheckboxItem:RightLabel() error("This item does not support a right label") end
1789
1790 function UIMenuCheckboxItem:Draw()
1791 self.Base:Draw()
1792 self.CheckedSprite:Position(380 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, self.CheckedSprite.Y)
1793 if self.CheckboxStyle == nil or self.CheckboxStyle == tonumber(1) then
1794 if self.Base:Selected() then
1795 if self.Checked then
1796 self.CheckedSprite.TxtName = "shop_box_tickb"
1797 else
1798 self.CheckedSprite.TxtName = "shop_box_blankb"
1799 end
1800 else
1801 if self.Checked then
1802 self.CheckedSprite.TxtName = "shop_box_tick"
1803 else
1804 self.CheckedSprite.TxtName = "shop_box_blank"
1805 end
1806 end
1807 elseif self.CheckboxStyle == tonumber(2) then
1808 if self.Base:Selected() then
1809 if self.Checked then
1810 self.CheckedSprite.TxtName = "shop_box_crossb"
1811 else
1812 self.CheckedSprite.TxtName = "shop_box_blankb"
1813 end
1814 else
1815 if self.Checked then
1816 self.CheckedSprite.TxtName = "shop_box_cross"
1817 else
1818 self.CheckedSprite.TxtName = "shop_box_blank"
1819 end
1820 end
1821 end
1822 self.CheckedSprite:Draw()
1823 end
1824end
1825
1826--==================================================================================================================================================--
1827--[[ NativeUI\UIMenu\items\UIMenuListItem ]]
1828--==================================================================================================================================================--
1829UIMenuListItem = setmetatable({}, UIMenuListItem)
1830UIMenuListItem.__index = UIMenuListItem
1831UIMenuListItem.__call = function() return "UIMenuItem", "UIMenuListItem" end
1832do
1833 function UIMenuListItem.New(Text, Items, Index, Description)
1834 if type(Items) ~= "table" then Items = {} end
1835 if Index == 0 then Index = 1 end
1836 local _UIMenuListItem = {
1837 Base = UIMenuItem.New(Text or "", Description or ""),
1838 Items = Items,
1839 LeftArrow = Sprite.New("commonmenu", "arrowleft", 110, 105, 30, 30),
1840 RightArrow = Sprite.New("commonmenu", "arrowright", 280, 105, 30, 30),
1841 ItemText = UIResText.New("", 290, 104, 0.35, 255, 255, 255, 255, 0, "Right"),
1842 _Index = tonumber(Index) or 1,
1843 Panels = {},
1844 OnListChanged = function(menu, item, newindex) end,
1845 OnListSelected = function(menu, item, newindex) end
1846 }
1847 return setmetatable(_UIMenuListItem, UIMenuListItem)
1848 end
1849
1850 function UIMenuListItem:SetParentMenu(Menu)
1851 if Menu ~= nil and Menu() == "UIMenu" then
1852 self.Base.ParentMenu = Menu
1853 else
1854 return self.Base.ParentMenu
1855 end
1856 end
1857
1858 function UIMenuListItem:Position(Y)
1859 if tonumber(Y) then
1860 self.LeftArrow:Position(300 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, 147 + Y + self.Base._Offset.Y)
1861 self.RightArrow:Position(400 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, 147 + Y + self.Base._Offset.Y)
1862 self.ItemText:Position(300 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, 147 + Y + self.Base._Offset.Y)
1863 self.Base:Position(Y)
1864 end
1865 end
1866
1867 function UIMenuListItem:Selected(bool)
1868 if bool ~= nil then
1869 self.Base._Selected = ToBool(bool)
1870 else
1871 return self.Base._Selected
1872 end
1873 end
1874
1875 function UIMenuListItem:Hovered(bool)
1876 if bool ~= nil then
1877 self.Base._Hovered = ToBool(bool)
1878 else
1879 return self.Base._Hovered
1880 end
1881 end
1882
1883 function UIMenuListItem:Enabled(bool)
1884 if bool ~= nil then
1885 self.Base._Enabled = ToBool(bool)
1886 else
1887 return self.Base._Enabled
1888 end
1889 end
1890
1891 function UIMenuListItem:Description(str)
1892 if tostring(str) and str ~= nil then
1893 self.Base._Description = tostring(str)
1894 else
1895 return self.Base._Description
1896 end
1897 end
1898
1899 function UIMenuListItem:Offset(X, Y)
1900 if tonumber(X) or tonumber(Y) then
1901 if tonumber(X) then self.Base._Offset.X = tonumber(X) end
1902 if tonumber(Y) then self.Base._Offset.Y = tonumber(Y) end
1903 else
1904 return self.Base._Offset
1905 end
1906 end
1907
1908 function UIMenuListItem:Text(Text)
1909 if tostring(Text) and Text ~= nil then
1910 self.Base.Text:Text(tostring(Text))
1911 else
1912 return self.Base.Text:Text()
1913 end
1914 end
1915
1916 function UIMenuListItem:Index(Index)
1917 if tonumber(Index) then
1918 if tonumber(Index) > #self.Items then
1919 self._Index = 1
1920 elseif tonumber(Index) < 1 then
1921 self._Index = #self.Items
1922 else
1923 self._Index = tonumber(Index)
1924 end
1925 else
1926 return self._Index
1927 end
1928 end
1929
1930 function UIMenuListItem:ItemToIndex(Item)
1931 for i = 1, #self.Items do
1932 if type(Item) == type(self.Items[i]) and Item == self.Items[i] then
1933 return i
1934 elseif type(self.Items[i]) == "table" and (type(Item) == type(self.Items[i].Name) or type(Item) == type(self.Items[i].Value)) and
1935 (Item == self.Items[i].Name or Item == self.Items[i].Value) then
1936 return i
1937 end
1938 end
1939 end
1940
1941 function UIMenuListItem:IndexToItem(Index)
1942 if tonumber(Index) then
1943 if tonumber(Index) == 0 then Index = 1 end
1944 if self.Items[tonumber(Index)] then return self.Items[tonumber(Index)] end
1945 end
1946 end
1947
1948 function UIMenuListItem:SetLeftBadge() error("This item does not support badges") end
1949
1950 function UIMenuListItem:SetRightBadge() error("This item does not support badges") end
1951
1952 function UIMenuListItem:RightLabel() error("This item does not support a right label") end
1953
1954 function UIMenuListItem:AddPanel(Panel)
1955 if Panel() == "UIMenuPanel" then
1956 table.insert(self.Panels, Panel)
1957 Panel:SetParentItem(self)
1958 end
1959 end
1960
1961 function UIMenuListItem:RemovePanelAt(Index)
1962 if tonumber(Index) then if self.Panels[Index] then table.remove(self.Panels, tonumber(Index)) end end
1963 end
1964
1965 function UIMenuListItem:FindPanelIndex(Panel)
1966 if Panel() == "UIMenuPanel" then for Index = 1, #self.Panels do if self.Panels[Index] == Panel then return Index end end end
1967 return nil
1968 end
1969
1970 function UIMenuListItem:FindPanelItem()
1971 for Index = #self.Items, 1, -1 do if self.Items[Index].Panel then return Index end end
1972 return nil
1973 end
1974
1975 function UIMenuListItem:Draw()
1976 self.Base:Draw()
1977
1978 if self:Enabled() then
1979 if self:Selected() then
1980 self.ItemText:Colour(0, 0, 0, 255)
1981 self.LeftArrow:Colour(0, 0, 0, 255)
1982 self.RightArrow:Colour(0, 0, 0, 255)
1983 else
1984 self.ItemText:Colour(245, 245, 245, 255)
1985 self.LeftArrow:Colour(245, 245, 245, 255)
1986 self.RightArrow:Colour(245, 245, 245, 255)
1987 end
1988 else
1989 self.ItemText:Colour(163, 159, 148, 255)
1990 self.LeftArrow:Colour(163, 159, 148, 255)
1991 self.RightArrow:Colour(163, 159, 148, 255)
1992 end
1993
1994 local Text = (type(self.Items[self._Index]) == "table") and tostring(self.Items[self._Index].Name) or
1995 tostring(self.Items[self._Index])
1996 local Offset = MeasureStringWidth(Text, 0, 0.35)
1997
1998 self.ItemText:Text(Text)
1999 self.LeftArrow:Position(378 - Offset + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, self.LeftArrow.Y)
2000
2001 self.LeftArrow:Draw()
2002 self.RightArrow:Draw()
2003 self.ItemText:Position(403 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, self.ItemText.Y)
2004
2005 self.ItemText:Draw()
2006 end
2007end
2008
2009--==================================================================================================================================================--
2010--[[ NativeUI\UIMenu\items\UIMenuColouredItem ]]
2011--==================================================================================================================================================--
2012UIMenuColouredItem = setmetatable({}, UIMenuColouredItem)
2013UIMenuColouredItem.__index = UIMenuColouredItem
2014UIMenuColouredItem.__call = function() return "UIMenuItem", "UIMenuColouredItem" end
2015do
2016 function UIMenuColouredItem.New(Text, Description, MainColour, HighlightColour)
2017 if type(Colour) ~= "table" then Colour = {R = 0, G = 0, B = 0, A = 255} end
2018 if type(HighlightColour) ~= "table" then Colour = {R = 255, G = 255, B = 255, A = 255} end
2019 local _UIMenuColouredItem = {
2020 Base = UIMenuItem.New(Text or "", Description or ""),
2021 Rectangle = UIResRectangle.New(0, 0, 431, 38, MainColour.R, MainColour.G, MainColour.B, MainColour.A),
2022 MainColour = MainColour,
2023 HighlightColour = HighlightColour,
2024 ParentMenu = nil,
2025 Activated = function(menu, item) end
2026 }
2027 _UIMenuColouredItem.Base.SelectedSprite:Colour(HighlightColour.R, HighlightColour.G, HighlightColour.B, HighlightColour.A)
2028 return setmetatable(_UIMenuColouredItem, UIMenuColouredItem)
2029 end
2030
2031 function UIMenuColouredItem:SetParentMenu(Menu)
2032 if Menu() == "UIMenu" then
2033 self.Base.ParentMenu = Menu
2034 self.ParentMenu = Menu
2035 else
2036 return self.Base.ParentMenu
2037 end
2038 end
2039
2040 function UIMenuColouredItem:Position(Y)
2041 if tonumber(Y) then
2042 self.Base:Position(Y)
2043 self.Rectangle:Position(self.Base._Offset.X, Y + 144 + self.Base._Offset.Y)
2044 end
2045 end
2046
2047 function UIMenuColouredItem:Selected(bool)
2048 if bool ~= nil then
2049 self.Base._Selected = ToBool(bool)
2050 else
2051 return self.Base._Selected
2052 end
2053 end
2054
2055 function UIMenuColouredItem:Hovered(bool)
2056 if bool ~= nil then
2057 self.Base._Hovered = ToBool(bool)
2058 else
2059 return self.Base._Hovered
2060 end
2061 end
2062
2063 function UIMenuColouredItem:Enabled(bool)
2064 if bool ~= nil then
2065 self.Base._Enabled = ToBool(bool)
2066 else
2067 return self.Base._Enabled
2068 end
2069 end
2070
2071 function UIMenuColouredItem:Description(str)
2072 if tostring(str) and str ~= nil then
2073 self.Base._Description = tostring(str)
2074 else
2075 return self.Base._Description
2076 end
2077 end
2078
2079 function UIMenuColouredItem:Offset(X, Y)
2080 if tonumber(X) or tonumber(Y) then
2081 if tonumber(X) then self.Base._Offset.X = tonumber(X) end
2082 if tonumber(Y) then self.Base._Offset.Y = tonumber(Y) end
2083 else
2084 return self.Base._Offset
2085 end
2086 end
2087
2088 function UIMenuColouredItem:Text(Text)
2089 if tostring(Text) and Text ~= nil then
2090 self.Base.Text:Text(tostring(Text))
2091 else
2092 return self.Base.Text:Text()
2093 end
2094 end
2095
2096 function UIMenuColouredItem:SetTextSelectedColor(R, G, B, A)
2097 if tonumber(R) and tonumber(G) and tonumber(B) and tonumber(A) then
2098 self.Base._Text.Colour.Selected.R = R
2099 self.Base._Text.Colour.Selected.G = G
2100 self.Base._Text.Colour.Selected.B = B
2101 self.Base._Text.Colour.Selected.A = A
2102 else
2103 return {
2104 R = self.Base._Text.Colour.Selected.R,
2105 G = self.Base._Text.Colour.Selected.G,
2106 B = self.Base._Text.Colour.Selected.B,
2107 A = self.Base._Text.Colour.Selected.A
2108 }
2109 end
2110 end
2111
2112 function UIMenuColouredItem:SetTextHoveredColor(R, G, B, A)
2113 if tonumber(R) and tonumber(G) and tonumber(B) and tonumber(A) then
2114 self.Base._Text.Colour.Hovered.R = R
2115 self.Base._Text.Colour.Hovered.G = G
2116 self.Base._Text.Colour.Hovered.B = B
2117 self.Base._Text.Colour.Hovered.A = A
2118 else
2119 return {
2120 R = self.Base._Text.Colour.Hovered.R,
2121 G = self.Base._Text.Colour.Hovered.G,
2122 B = self.Base._Text.Colour.Hovered.B,
2123 A = self.Base._Text.Colour.Hovered.A
2124 }
2125 end
2126 end
2127
2128 function UIMenuColouredItem:RightLabel(Text, MainColour, HighlightColour)
2129 if tostring(Text) and Text ~= nil then
2130 if type(MainColour) == "table" then self.Base.Label.MainColour = MainColour end
2131 if type(HighlightColour) == "table" then self.Base.Label.HighlightColour = HighlightColour end
2132 self.Base.Label.Text:Text(tostring(Text))
2133 else
2134 self.Label.MainColour = {R = 0, G = 0, B = 0, A = 0}
2135 self.Label.HighlightColour = {R = 0, G = 0, B = 0, A = 0}
2136 return self.Base.Label.Text:Text()
2137 end
2138 end
2139
2140 function UIMenuColouredItem:SetLeftBadge(Badge) if tonumber(Badge) then self.Base.LeftBadge.Badge = tonumber(Badge) end end
2141
2142 function UIMenuColouredItem:SetRightBadge(Badge) if tonumber(Badge) then self.Base.RightBadge.Badge = tonumber(Badge) end end
2143
2144 function UIMenuColouredItem:Draw()
2145 self.Rectangle:Size(431 + self.ParentMenu.WidthOffset, self.Rectangle.Height)
2146 self.Rectangle:Draw()
2147 self.Base:Draw()
2148 end
2149end
2150
2151--==================================================================================================================================================--
2152--[[ NativeUI\UIMenu\items\UIMenuProgressItem ]]
2153--==================================================================================================================================================--
2154UIMenuProgressItem = setmetatable({}, UIMenuProgressItem)
2155UIMenuProgressItem.__index = UIMenuProgressItem
2156UIMenuProgressItem.__call = function() return "UIMenuItem", "UIMenuProgressItem" end
2157do
2158 function UIMenuProgressItem.New(Text, Items, Index, Description, Counter)
2159 if type(Items) ~= "table" then Items = {} end
2160 if Index == 0 then Index = 1 end
2161 local _UIMenuProgressItem = {
2162 Base = UIMenuItem.New(Text or "", Description or ""),
2163 Data = {Items = Items, Counter = ToBool(Counter), Max = 407.5, Index = tonumber(Index) or 1},
2164 Audio = {Slider = "CONTINUOUS_SLIDER", Library = "HUD_FRONTEND_DEFAULT_SOUNDSET", Id = nil},
2165 Background = UIResRectangle.New(0, 0, 415, 20, 0, 0, 0, 255),
2166 Bar = UIResRectangle.New(0, 0, 407.5, 12.5),
2167 OnProgressChanged = function(menu, item, newindex) end,
2168 OnProgressSelected = function(menu, item, newindex) end
2169 }
2170
2171 _UIMenuProgressItem.Base.Rectangle.Height = 60
2172 _UIMenuProgressItem.Base.SelectedSprite.Height = 60
2173
2174 if _UIMenuProgressItem.Data.Counter then
2175 _UIMenuProgressItem.Base:RightLabel(_UIMenuProgressItem.Data.Index .. "/" .. #_UIMenuProgressItem.Data.Items)
2176 else
2177 _UIMenuProgressItem.Base:RightLabel((type(_UIMenuProgressItem.Data.Items[_UIMenuProgressItem.Data.Index]) == "table") and
2178 tostring(_UIMenuProgressItem.Data.Items[_UIMenuProgressItem.Data.Index].Name) or
2179 tostring(_UIMenuProgressItem.Data.Items[_UIMenuProgressItem.Data.Index]))
2180 end
2181
2182 _UIMenuProgressItem.Bar.Width = _UIMenuProgressItem.Data.Index / #_UIMenuProgressItem.Data.Items * _UIMenuProgressItem.Data.Max
2183
2184 return setmetatable(_UIMenuProgressItem, UIMenuProgressItem)
2185 end
2186
2187 function UIMenuProgressItem:SetParentMenu(Menu)
2188 if Menu() == "UIMenu" then
2189 self.Base.ParentMenu = Menu
2190 else
2191 return self.Base.ParentMenu
2192 end
2193 end
2194
2195 function UIMenuProgressItem:Position(Y)
2196 if tonumber(Y) then
2197 self.Base:Position(Y)
2198 self.Data.Max = 407.5 + self.Base.ParentMenu.WidthOffset
2199 self.Background:Size(415 + self.Base.ParentMenu.WidthOffset, 20)
2200 self.Background:Position(8 + self.Base._Offset.X, 177 + Y + self.Base._Offset.Y)
2201 self.Bar:Position(11.75 + self.Base._Offset.X, 180.75 + Y + self.Base._Offset.Y)
2202 end
2203 end
2204
2205 function UIMenuProgressItem:Selected(bool)
2206 if bool ~= nil then
2207 self.Base._Selected = ToBool(bool)
2208 else
2209 return self.Base._Selected
2210 end
2211 end
2212
2213 function UIMenuProgressItem:Hovered(bool)
2214 if bool ~= nil then
2215 self.Base._Hovered = ToBool(bool)
2216 else
2217 return self.Base._Hovered
2218 end
2219 end
2220
2221 function UIMenuProgressItem:Enabled(bool)
2222 if bool ~= nil then
2223 self.Base._Enabled = ToBool(bool)
2224 else
2225 return self.Base._Enabled
2226 end
2227 end
2228
2229 function UIMenuProgressItem:Description(str)
2230 if tostring(str) and str ~= nil then
2231 self.Base._Description = tostring(str)
2232 else
2233 return self.Base._Description
2234 end
2235 end
2236
2237 function UIMenuProgressItem:Offset(X, Y)
2238 if tonumber(X) or tonumber(Y) then
2239 if tonumber(X) then self.Base._Offset.X = tonumber(X) end
2240 if tonumber(Y) then self.Base._Offset.Y = tonumber(Y) end
2241 else
2242 return self.Base._Offset
2243 end
2244 end
2245
2246 function UIMenuProgressItem:Text(Text)
2247 if tostring(Text) and Text ~= nil then
2248 self.Base.Text:Text(tostring(Text))
2249 else
2250 return self.Base.Text:Text()
2251 end
2252 end
2253
2254 function UIMenuProgressItem:Index(Index)
2255 if tonumber(Index) then
2256 if tonumber(Index) > #self.Data.Items then
2257 self.Data.Index = 1
2258 elseif tonumber(Index) < 1 then
2259 self.Data.Index = #self.Data.Items
2260 else
2261 self.Data.Index = tonumber(Index)
2262 end
2263
2264 if self.Data.Counter then
2265 self.Base:RightLabel(self.Data.Index .. "/" .. #self.Data.Items)
2266 else
2267 self.Base:RightLabel(
2268 (type(self.Data.Items[self.Data.Index]) == "table") and tostring(self.Data.Items[self.Data.Index].Name) or
2269 tostring(self.Data.Items[self.Data.Index]))
2270 end
2271
2272 self.Bar.Width = self.Data.Index / #self.Data.Items * self.Data.Max
2273 else
2274 return self.Data.Index
2275 end
2276 end
2277
2278 function UIMenuProgressItem:ItemToIndex(Item)
2279 for i = 1, #self.Data.Items do
2280 if type(Item) == type(self.Data.Items[i]) and Item == self.Data.Items[i] then
2281 return i
2282 elseif type(self.Data.Items[i]) == "table" and
2283 (type(Item) == type(self.Data.Items[i].Name) or type(Item) == type(self.Data.Items[i].Value)) and
2284 (Item == self.Data.Items[i].Name or Item == self.Data.Items[i].Value) then
2285 return i
2286 end
2287 end
2288 end
2289
2290 function UIMenuProgressItem:IndexToItem(Index)
2291 if tonumber(Index) then
2292 if tonumber(Index) == 0 then Index = 1 end
2293 if self.Data.Items[tonumber(Index)] then return self.Data.Items[tonumber(Index)] end
2294 end
2295 end
2296
2297 function UIMenuProgressItem:SetLeftBadge() error("This item does not support badges") end
2298
2299 function UIMenuProgressItem:SetRightBadge() error("This item does not support badges") end
2300
2301 function UIMenuProgressItem:RightLabel() error("This item does not support a right label") end
2302
2303 function UIMenuProgressItem:CalculateProgress(CursorX)
2304 local Progress = CursorX - self.Bar.X
2305 self:Index(math.round(#self.Data.Items *
2306 (((Progress >= 0 and Progress <= self.Data.Max) and Progress or ((Progress < 0) and 0 or self.Data.Max)) /
2307 self.Data.Max)))
2308 end
2309
2310 function UIMenuProgressItem:Draw()
2311 self.Base:Draw()
2312
2313 if self.Base._Selected then
2314 self.Background:Colour(table.unpack(Colours.Black))
2315 self.Bar:Colour(table.unpack(Colours.White))
2316 else
2317 self.Background:Colour(table.unpack(Colours.White))
2318 self.Bar:Colour(table.unpack(Colours.Black))
2319 end
2320
2321 self.Background:Draw()
2322 self.Bar:Draw()
2323 end
2324end
2325
2326--==================================================================================================================================================--
2327--[[ NativeUI\UIMenu\items\UIMenuSeparatorItem ]]
2328--==================================================================================================================================================--
2329UIMenuSeparatorItem = setmetatable({}, UIMenuSeparatorItem)
2330UIMenuSeparatorItem.__index = UIMenuSeparatorItem
2331UIMenuSeparatorItem.__call = function() return "UIMenuItem", "UIMenuSeparatorItem" end
2332do
2333 function UIMenuSeparatorItem.New()
2334 local _UIMenuSeparatorItem = {Base = UIMenuItem.New(Text or "N/A", Description or "")}
2335
2336 _UIMenuSeparatorItem.Base.Label.Text.Alignment = "Center"
2337 return setmetatable(_UIMenuSeparatorItem, UIMenuSeparatorItem)
2338 end
2339
2340 function UIMenuSeparatorItem:SetParentMenu(Menu)
2341 if Menu() == "UIMenu" then
2342 self.Base.ParentMenu = Menu
2343 else
2344 return self.Base.ParentMenu
2345 end
2346 end
2347
2348 function UIMenuSeparatorItem:Position(Y) if tonumber(Y) then self.Base:Position(Y) end end
2349
2350 function UIMenuSeparatorItem:Selected(bool)
2351 if bool ~= nil then
2352 self.Base._Selected = ToBool(bool)
2353 else
2354 return self.Base._Selected
2355 end
2356 end
2357
2358 function UIMenuSeparatorItem:Hovered(bool)
2359 if bool ~= nil then
2360 self.Base._Hovered = ToBool(bool)
2361 else
2362 return self.Base._Hovered
2363 end
2364 end
2365
2366 function UIMenuSeparatorItem:Enabled(bool)
2367 if bool ~= nil then
2368 self.Base._Enabled = ToBool(bool)
2369 else
2370 return self.Base._Enabled
2371 end
2372 end
2373
2374 function UIMenuSeparatorItem:Description(str)
2375 if tostring(str) and str ~= nil then
2376 self.Base._Description = tostring(str)
2377 else
2378 return self.Base._Description
2379 end
2380 end
2381
2382 function UIMenuSeparatorItem:Offset(X, Y)
2383 if tonumber(X) or tonumber(Y) then
2384 if tonumber(X) then self.Base._Offset.X = tonumber(X) end
2385 if tonumber(Y) then self.Base._Offset.Y = tonumber(Y) end
2386 else
2387 return self.Base._Offset
2388 end
2389 end
2390
2391 function UIMenuSeparatorItem:Text(Text)
2392 if tostring(Text) and Text ~= nil then
2393 self.Base.Text:Text(tostring(Text))
2394 else
2395 return self.Base.Text:Text()
2396 end
2397 end
2398
2399 function UIMenuSeparatorItem:Draw()
2400 self.Base:Draw()
2401
2402 if self.Base._Selected then
2403 else
2404 end
2405
2406 end
2407end
2408
2409--==================================================================================================================================================--
2410--[[ NativeUI\UIMenu\items\UIMenuSliderHeritageItem ]]
2411--==================================================================================================================================================--
2412UIMenuSliderHeritageItem = setmetatable({}, UIMenuSliderHeritageItem)
2413UIMenuSliderHeritageItem.__index = UIMenuSliderHeritageItem
2414UIMenuSliderHeritageItem.__call = function() return "UIMenuItem", "UIMenuSliderHeritageItem" end
2415do
2416 function UIMenuSliderHeritageItem.New(Text, Items, Index, Description, SliderColors, BackgroundSliderColors)
2417 if type(Items) ~= "table" then Items = {} end
2418 if Index == 0 then Index = 1 end
2419
2420 if type(SliderColors) ~= "table" or SliderColors == nil then
2421 _SliderColors = {R = 57, G = 119, B = 200, A = 255}
2422 else
2423 _SliderColors = SliderColors
2424 end
2425
2426 if type(BackgroundSliderColors) ~= "table" or BackgroundSliderColors == nil then
2427 _BackgroundSliderColors = {R = 4, G = 32, B = 57, A = 255}
2428 else
2429 _BackgroundSliderColors = BackgroundSliderColors
2430 end
2431
2432 local _UIMenuSliderHeritageItem = {
2433 Base = UIMenuItem.New(Text or "", Description or ""),
2434 Items = Items,
2435 LeftArrow = Sprite.New("mpleaderboard", "leaderboard_female_icon", 0, 0, 40, 40, 0, 255, 255, 255, 255),
2436 RightArrow = Sprite.New("mpleaderboard", "leaderboard_male_icon", 0, 0, 40, 40, 0, 255, 255, 255, 255),
2437 Background = UIResRectangle.New(0, 0, 150, 10, _BackgroundSliderColors.R, _BackgroundSliderColors.G, _BackgroundSliderColors.B,
2438 _BackgroundSliderColors.A),
2439 Slider = UIResRectangle.New(0, 0, 75, 10, _SliderColors.R, _SliderColors.G, _SliderColors.B, _SliderColors.A),
2440 Divider = UIResRectangle.New(0, 0, 4, 20, 255, 255, 255, 255),
2441 _Index = tonumber(Index) or 1,
2442 Audio = {Slider = "CONTINUOUS_SLIDER", Library = "HUD_FRONTEND_DEFAULT_SOUNDSET", Id = nil},
2443 OnSliderChanged = function(menu, item, newindex) end,
2444 OnSliderSelected = function(menu, item, newindex) end
2445 }
2446 return setmetatable(_UIMenuSliderHeritageItem, UIMenuSliderHeritageItem)
2447 end
2448
2449 function UIMenuSliderHeritageItem:SetParentMenu(Menu)
2450 if Menu() == "UIMenu" then
2451 self.Base.ParentMenu = Menu
2452 else
2453 return self.Base.ParentMenu
2454 end
2455 end
2456
2457 function UIMenuSliderHeritageItem:Position(Y)
2458 if tonumber(Y) then
2459 self.Background:Position(250 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, Y + 158.5 + self.Base._Offset.Y)
2460 self.Slider:Position(250 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, Y + 158.5 + self.Base._Offset.Y)
2461 self.Divider:Position(323.5 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, Y + 153 + self.Base._Offset.Y)
2462 self.LeftArrow:Position(217 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, 143.5 + Y + self.Base._Offset.Y)
2463 self.RightArrow:Position(395 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, 143.5 + Y + self.Base._Offset.Y)
2464 self.Base:Position(Y)
2465 end
2466 end
2467
2468 function UIMenuSliderHeritageItem:Selected(bool)
2469 if bool ~= nil then
2470 self.Base._Selected = ToBool(bool)
2471 else
2472 return self.Base._Selected
2473 end
2474 end
2475
2476 function UIMenuSliderHeritageItem:Hovered(bool)
2477 if bool ~= nil then
2478 self.Base._Hovered = ToBool(bool)
2479 else
2480 return self.Base._Hovered
2481 end
2482 end
2483
2484 function UIMenuSliderHeritageItem:Enabled(bool)
2485 if bool ~= nil then
2486 self.Base._Enabled = ToBool(bool)
2487 else
2488 return self.Base._Enabled
2489 end
2490 end
2491
2492 function UIMenuSliderHeritageItem:Description(str)
2493 if tostring(str) and str ~= nil then
2494 self.Base._Description = tostring(str)
2495 else
2496 return self.Base._Description
2497 end
2498 end
2499
2500 function UIMenuSliderHeritageItem:Offset(X, Y)
2501 if tonumber(X) or tonumber(Y) then
2502 if tonumber(X) then self.Base._Offset.X = tonumber(X) end
2503 if tonumber(Y) then self.Base._Offset.Y = tonumber(Y) end
2504 else
2505 return self.Base._Offset
2506 end
2507 end
2508
2509 function UIMenuSliderHeritageItem:Text(Text)
2510 if tostring(Text) and Text ~= nil then
2511 self.Base.Text:Text(tostring(Text))
2512 else
2513 return self.Base.Text:Text()
2514 end
2515 end
2516
2517 function UIMenuSliderHeritageItem:Index(Index)
2518 if tonumber(Index) then
2519 if tonumber(Index) > #self.Items then
2520 self._Index = 1
2521 elseif tonumber(Index) < 1 then
2522 self._Index = #self.Items
2523 else
2524 self._Index = tonumber(Index)
2525 end
2526 else
2527 return self._Index
2528 end
2529 end
2530
2531 function UIMenuSliderHeritageItem:ItemToIndex(Item)
2532 for i = 1, #self.Items do if type(Item) == type(self.Items[i]) and Item == self.Items[i] then return i end end
2533 end
2534
2535 function UIMenuSliderHeritageItem:IndexToItem(Index)
2536 if tonumber(Index) then
2537 if tonumber(Index) == 0 then Index = 1 end
2538 if self.Items[tonumber(Index)] then return self.Items[tonumber(Index)] end
2539 end
2540 end
2541
2542 function UIMenuSliderHeritageItem:SetLeftBadge() error("This item does not support badges") end
2543
2544 function UIMenuSliderHeritageItem:SetRightBadge() error("This item does not support badges") end
2545
2546 function UIMenuSliderHeritageItem:RightLabel() error("This item does not support a right label") end
2547
2548 function UIMenuSliderHeritageItem:Draw()
2549 self.Base:Draw()
2550 if self:Enabled() then
2551 if self:Selected() then
2552 self.LeftArrow:Colour(0, 0, 0, 255)
2553 self.RightArrow:Colour(0, 0, 0, 255)
2554 else
2555 self.LeftArrow:Colour(255, 255, 255, 255)
2556 self.RightArrow:Colour(255, 255, 255, 255)
2557 end
2558 else
2559 self.LeftArrow:Colour(255, 255, 255, 255)
2560 self.RightArrow:Colour(255, 255, 255, 255)
2561 end
2562 local Offset = ((self.Background.Width - self.Slider.Width) / (#self.Items - 1)) * (self._Index - 1)
2563 self.Slider:Position(250 + self.Base._Offset.X + Offset + self.Base.ParentMenu.WidthOffset, self.Slider.Y)
2564 self.LeftArrow:Draw()
2565 self.RightArrow:Draw()
2566 self.Background:Draw()
2567 self.Slider:Draw()
2568 self.Divider:Draw()
2569 self.Divider:Colour(255, 255, 255, 255)
2570 end
2571end
2572
2573--==================================================================================================================================================--
2574--[[ NativeUI\UIMenu\items\UIMenuSliderItem ]]
2575--==================================================================================================================================================--
2576UIMenuSliderItem = setmetatable({}, UIMenuSliderItem)
2577UIMenuSliderItem.__index = UIMenuSliderItem
2578UIMenuSliderItem.__call = function() return "UIMenuItem", "UIMenuSliderItem" end
2579do
2580 function UIMenuSliderItem.New(Text, Items, Index, Description, Divider, SliderColors, BackgroundSliderColors)
2581 if type(Items) ~= "table" then Items = {} end
2582 if Index == 0 then Index = 1 end
2583 if type(SliderColors) ~= "table" or SliderColors == nil then
2584 _SliderColors = {R = 57, G = 119, B = 200, A = 255}
2585 else
2586 _SliderColors = SliderColors
2587 end
2588 if type(BackgroundSliderColors) ~= "table" or BackgroundSliderColors == nil then
2589 _BackgroundSliderColors = {R = 4, G = 32, B = 57, A = 255}
2590 else
2591 _BackgroundSliderColors = BackgroundSliderColors
2592 end
2593 local _UIMenuSliderItem = {
2594 Base = UIMenuItem.New(Text or "", Description or ""),
2595 Items = Items,
2596 ShowDivider = ToBool(Divider),
2597 LeftArrow = Sprite.New("commonmenu", "arrowleft", 0, 105, 25, 25),
2598 RightArrow = Sprite.New("commonmenu", "arrowright", 0, 105, 25, 25),
2599 Background = UIResRectangle.New(0, 0, 150, 10, _BackgroundSliderColors.R, _BackgroundSliderColors.G, _BackgroundSliderColors.B,
2600 _BackgroundSliderColors.A),
2601 Slider = UIResRectangle.New(0, 0, 75, 10, _SliderColors.R, _SliderColors.G, _SliderColors.B, _SliderColors.A),
2602 Divider = UIResRectangle.New(0, 0, 4, 20, 255, 255, 255, 255),
2603 _Index = tonumber(Index) or 1,
2604 OnSliderChanged = function(menu, item, newindex) end,
2605 OnSliderSelected = function(menu, item, newindex) end
2606 }
2607 return setmetatable(_UIMenuSliderItem, UIMenuSliderItem)
2608 end
2609
2610 function UIMenuSliderItem:SetParentMenu(Menu)
2611 if Menu() == "UIMenu" then
2612 self.Base.ParentMenu = Menu
2613 else
2614 return self.Base.ParentMenu
2615 end
2616 end
2617
2618 function UIMenuSliderItem:Position(Y)
2619 if tonumber(Y) then
2620 self.Background:Position(250 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, Y + 158.5 + self.Base._Offset.Y)
2621 self.Slider:Position(250 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, Y + 158.5 + self.Base._Offset.Y)
2622 self.Divider:Position(323.5 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, Y + 153 + self.Base._Offset.Y)
2623 self.LeftArrow:Position(225 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, 150.5 + Y + self.Base._Offset.Y)
2624 self.RightArrow:Position(400 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, 150.5 + Y + self.Base._Offset.Y)
2625 self.Base:Position(Y)
2626 end
2627 end
2628
2629 function UIMenuSliderItem:Selected(bool)
2630 if bool ~= nil then
2631
2632 self.Base._Selected = ToBool(bool)
2633 else
2634 return self.Base._Selected
2635 end
2636 end
2637
2638 function UIMenuSliderItem:Hovered(bool)
2639 if bool ~= nil then
2640 self.Base._Hovered = ToBool(bool)
2641 else
2642 return self.Base._Hovered
2643 end
2644 end
2645
2646 function UIMenuSliderItem:Enabled(bool)
2647 if bool ~= nil then
2648 self.Base._Enabled = ToBool(bool)
2649 else
2650 return self.Base._Enabled
2651 end
2652 end
2653
2654 function UIMenuSliderItem:Description(str)
2655 if tostring(str) and str ~= nil then
2656 self.Base._Description = tostring(str)
2657 else
2658 return self.Base._Description
2659 end
2660 end
2661
2662 function UIMenuSliderItem:Offset(X, Y)
2663 if tonumber(X) or tonumber(Y) then
2664 if tonumber(X) then self.Base._Offset.X = tonumber(X) end
2665 if tonumber(Y) then self.Base._Offset.Y = tonumber(Y) end
2666 else
2667 return self.Base._Offset
2668 end
2669 end
2670
2671 function UIMenuSliderItem:Text(Text)
2672 if tostring(Text) and Text ~= nil then
2673 self.Base.Text:Text(tostring(Text))
2674 else
2675 return self.Base.Text:Text()
2676 end
2677 end
2678
2679 function UIMenuSliderItem:Index(Index)
2680 if tonumber(Index) then
2681 if tonumber(Index) > #self.Items then
2682 self._Index = 1
2683 elseif tonumber(Index) < 1 then
2684 self._Index = #self.Items
2685 else
2686 self._Index = tonumber(Index)
2687 end
2688 else
2689 return self._Index
2690 end
2691 end
2692
2693 function UIMenuSliderItem:ItemToIndex(Item)
2694 for i = 1, #self.Items do if type(Item) == type(self.Items[i]) and Item == self.Items[i] then return i end end
2695 end
2696
2697 function UIMenuSliderItem:IndexToItem(Index)
2698 if tonumber(Index) then
2699 if tonumber(Index) == 0 then Index = 1 end
2700 if self.Items[tonumber(Index)] then return self.Items[tonumber(Index)] end
2701 end
2702 end
2703
2704 function UIMenuSliderItem:SetLeftBadge() error("This item does not support badges") end
2705
2706 function UIMenuSliderItem:SetRightBadge() error("This item does not support badges") end
2707
2708 function UIMenuSliderItem:RightLabel() error("This item does not support a right label") end
2709
2710 function UIMenuSliderItem:Draw()
2711 self.Base:Draw()
2712
2713 if self:Enabled() then
2714 if self:Selected() then
2715 self.LeftArrow:Colour(0, 0, 0, 255)
2716 self.RightArrow:Colour(0, 0, 0, 255)
2717 else
2718 self.LeftArrow:Colour(245, 245, 245, 255)
2719 self.RightArrow:Colour(245, 245, 245, 255)
2720 end
2721 else
2722 self.LeftArrow:Colour(163, 159, 148, 255)
2723 self.RightArrow:Colour(163, 159, 148, 255)
2724 end
2725
2726 local Offset = ((self.Background.Width - self.Slider.Width) / (#self.Items - 1)) * (self._Index - 1)
2727
2728 self.Slider:Position(250 + self.Base._Offset.X + Offset + self.Base.ParentMenu.WidthOffset, self.Slider.Y)
2729
2730 if self:Selected() then
2731 self.LeftArrow:Draw()
2732 self.RightArrow:Draw()
2733 end
2734
2735 self.Background:Draw()
2736 self.Slider:Draw()
2737 if self.ShowDivider then self.Divider:Draw() end
2738 end
2739end
2740
2741--==================================================================================================================================================--
2742--[[ NativeUI\UIMenu\items\UIMenuSliderProgressItem ]]
2743--==================================================================================================================================================--
2744UIMenuSliderProgressItem = setmetatable({}, UIMenuSliderProgressItem)
2745UIMenuSliderProgressItem.__index = UIMenuSliderProgressItem
2746UIMenuSliderProgressItem.__call = function() return "UIMenuItem", "UIMenuSliderProgressItem" end
2747do
2748 function UIMenuSliderProgressItem.New(Text, Items, Index, Description, SliderColors, BackgroundSliderColors)
2749 if type(Items) ~= "table" then Items = {} end
2750 if Index == 0 then Index = 1 end
2751 if type(SliderColors) ~= "table" or SliderColors == nil then
2752 _SliderColors = {R = 57, G = 119, B = 200, A = 255}
2753 else
2754 _SliderColors = SliderColors
2755 end
2756 if type(BackgroundSliderColors) ~= "table" or BackgroundSliderColors == nil then
2757 _BackgroundSliderColors = {R = 4, G = 32, B = 57, A = 255}
2758 else
2759 _BackgroundSliderColors = BackgroundSliderColors
2760 end
2761 local _UIMenuSliderProgressItem = {
2762 Base = UIMenuItem.New(Text or "", Description or ""),
2763 Items = Items,
2764 LeftArrow = Sprite.New("commonmenu", "arrowleft", 0, 105, 25, 25),
2765 RightArrow = Sprite.New("commonmenu", "arrowright", 0, 105, 25, 25),
2766 Background = UIResRectangle.New(0, 0, 150, 10, _BackgroundSliderColors.R, _BackgroundSliderColors.G, _BackgroundSliderColors.B,
2767 _BackgroundSliderColors.A),
2768 Slider = UIResRectangle.New(0, 0, 75, 10, _SliderColors.R, _SliderColors.G, _SliderColors.B, _SliderColors.A),
2769 Divider = UIResRectangle.New(0, 0, 4, 20, 255, 255, 255, 255),
2770 _Index = tonumber(Index) or 1,
2771 OnSliderChanged = function(menu, item, newindex) end,
2772 OnSliderSelected = function(menu, item, newindex) end
2773 }
2774
2775 local Offset = ((_UIMenuSliderProgressItem.Background.Width) / (#_UIMenuSliderProgressItem.Items - 1)) *
2776 (_UIMenuSliderProgressItem._Index - 1)
2777 _UIMenuSliderProgressItem.Slider.Width = Offset
2778
2779 return setmetatable(_UIMenuSliderProgressItem, UIMenuSliderProgressItem)
2780 end
2781
2782 function UIMenuSliderProgressItem:SetParentMenu(Menu)
2783 if Menu() == "UIMenu" then
2784 self.Base.ParentMenu = Menu
2785 else
2786 return self.Base.ParentMenu
2787 end
2788 end
2789
2790 function UIMenuSliderProgressItem:Position(Y)
2791 if tonumber(Y) then
2792 self.Background:Position(250 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, Y + 158.5 + self.Base._Offset.Y)
2793 self.Slider:Position(250 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, Y + 158.5 + self.Base._Offset.Y)
2794 self.Divider:Position(323.5 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, Y + 153 + self.Base._Offset.Y)
2795 self.LeftArrow:Position(225 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, 150.5 + Y + self.Base._Offset.Y)
2796 self.RightArrow:Position(400 + self.Base._Offset.X + self.Base.ParentMenu.WidthOffset, 150.5 + Y + self.Base._Offset.Y)
2797 self.Base:Position(Y)
2798 end
2799 end
2800
2801 function UIMenuSliderProgressItem:Selected(bool)
2802 if bool ~= nil then
2803
2804 self.Base._Selected = ToBool(bool)
2805 else
2806 return self.Base._Selected
2807 end
2808 end
2809
2810 function UIMenuSliderProgressItem:Hovered(bool)
2811 if bool ~= nil then
2812 self.Base._Hovered = ToBool(bool)
2813 else
2814 return self.Base._Hovered
2815 end
2816 end
2817
2818 function UIMenuSliderProgressItem:Enabled(bool)
2819 if bool ~= nil then
2820 self.Base._Enabled = ToBool(bool)
2821 else
2822 return self.Base._Enabled
2823 end
2824 end
2825
2826 function UIMenuSliderProgressItem:Description(str)
2827 if tostring(str) and str ~= nil then
2828 self.Base._Description = tostring(str)
2829 else
2830 return self.Base._Description
2831 end
2832 end
2833
2834 function UIMenuSliderProgressItem:Offset(X, Y)
2835 if tonumber(X) or tonumber(Y) then
2836 if tonumber(X) then self.Base._Offset.X = tonumber(X) end
2837 if tonumber(Y) then self.Base._Offset.Y = tonumber(Y) end
2838 else
2839 return self.Base._Offset
2840 end
2841 end
2842
2843 function UIMenuSliderProgressItem:Text(Text)
2844 if tostring(Text) and Text ~= nil then
2845 self.Base.Text:Text(tostring(Text))
2846 else
2847 return self.Base.Text:Text()
2848 end
2849 end
2850
2851 function UIMenuSliderProgressItem:Index(Index)
2852 if tonumber(Index) then
2853 if tonumber(Index) > #self.Items then
2854 self._Index = #self.Items
2855 elseif tonumber(Index) < 1 then
2856 self._Index = 1
2857 else
2858 self._Index = tonumber(Index)
2859 end
2860 else
2861 local Offset = ((self.Background.Width) / (#self.Items - 1)) * (self._Index - 1)
2862 self.Slider.Width = Offset
2863 return self._Index
2864 end
2865 end
2866
2867 function UIMenuSliderProgressItem:ItemToIndex(Item)
2868 for i = 1, #self.Items do if type(Item) == type(self.Items[i]) and Item == self.Items[i] then return i end end
2869 end
2870
2871 function UIMenuSliderProgressItem:IndexToItem(Index)
2872 if tonumber(Index) then
2873 if tonumber(Index) == 0 then Index = 1 end
2874 if self.Items[tonumber(Index)] then return self.Items[tonumber(Index)] end
2875 end
2876 end
2877
2878 function UIMenuSliderProgressItem:SetLeftBadge() error("This item does not support badges") end
2879
2880 function UIMenuSliderProgressItem:SetRightBadge() error("This item does not support badges") end
2881
2882 function UIMenuSliderProgressItem:RightLabel() error("This item does not support a right label") end
2883
2884 function UIMenuSliderProgressItem:Draw()
2885 self.Base:Draw()
2886
2887 if self:Enabled() then
2888 if self:Selected() then
2889 self.LeftArrow:Colour(0, 0, 0, 255)
2890 self.RightArrow:Colour(0, 0, 0, 255)
2891 else
2892 self.LeftArrow:Colour(245, 245, 245, 255)
2893 self.RightArrow:Colour(245, 245, 245, 255)
2894 end
2895 else
2896 self.LeftArrow:Colour(163, 159, 148, 255)
2897 self.RightArrow:Colour(163, 159, 148, 255)
2898 end
2899
2900 if self:Selected() then
2901 self.LeftArrow:Draw()
2902 self.RightArrow:Draw()
2903 end
2904
2905 self.Background:Draw()
2906 self.Slider:Draw()
2907 end
2908end
2909
2910--==================================================================================================================================================--
2911--[[ NativeUI\UIMenu\panels\UIMenuColourPanel ]]
2912--==================================================================================================================================================--
2913UIMenuColourPanel = setmetatable({}, UIMenuColourPanel)
2914UIMenuColourPanel.__index = UIMenuColourPanel
2915UIMenuColourPanel.__call = function() return "UIMenuPanel", "UIMenuColourPanel" end
2916do
2917 function UIMenuColourPanel.New(Title, Colours)
2918 local _UIMenuColourPanel = {
2919 Data = {
2920 Pagination = {Min = 1, Max = 8, Total = 8},
2921 Index = 1000,
2922 Items = Colours,
2923 Title = Title or "Title",
2924 Enabled = true,
2925 Value = 1
2926 },
2927 Background = Sprite.New("commonmenu", "gradient_bgd", 0, 0, 431, 112),
2928 Bar = {},
2929 EnableArrow = true,
2930 LeftArrow = Sprite.New("commonmenu", "arrowleft", 0, 0, 30, 30),
2931 RightArrow = Sprite.New("commonmenu", "arrowright", 0, 0, 30, 30),
2932 SelectedRectangle = UIResRectangle.New(0, 0, 44.5, 8),
2933 Text = UIResText.New(Title .. " [1 / " .. #Colours .. "]" or "Title" .. " [1 / " .. #Colours .. "]", 0, 0, 0.35, 255, 255, 255,
2934 255, 0, "Centre"),
2935 ParentItem = nil
2936 }
2937
2938 for Index = 1, #Colours do
2939 if Index < 10 then
2940 table.insert(_UIMenuColourPanel.Bar, UIResRectangle.New(0, 0, 44.5, 44.5, table.unpack(Colours[Index])))
2941 else
2942 break
2943 end
2944 end
2945
2946 if #_UIMenuColourPanel.Data.Items ~= 0 then
2947 _UIMenuColourPanel.Data.Index = 1000 - (1000 % #_UIMenuColourPanel.Data.Items)
2948 _UIMenuColourPanel.Data.Pagination.Max = _UIMenuColourPanel.Data.Pagination.Total + 1
2949 _UIMenuColourPanel.Data.Pagination.Min = 0
2950 end
2951 return setmetatable(_UIMenuColourPanel, UIMenuColourPanel)
2952 end
2953
2954 function UIMenuColourPanel:SetParentItem(Item)
2955 -- required
2956 if Item() == "UIMenuItem" then
2957 self.ParentItem = Item
2958 else
2959 return self.ParentItem
2960 end
2961 end
2962
2963 function UIMenuColourPanel:Enabled(Enabled)
2964 if type(Enabled) == "boolean" then
2965 self.Data.Enabled = Enabled
2966 else
2967 return self.Data.Enabled
2968 end
2969 end
2970
2971 function UIMenuColourPanel:Position(Y)
2972 if tonumber(Y) then
2973 local ParentOffsetX, ParentOffsetWidth = self.ParentItem:Offset().X, self.ParentItem:SetParentMenu().WidthOffset
2974 self.Background:Position(ParentOffsetX, Y)
2975 for Index = 1, #self.Bar do
2976 self.Bar[Index]:Position(15 + (44.5 * (Index - 1)) + ParentOffsetX + (ParentOffsetWidth / 2), 55 + Y)
2977 end
2978 self.SelectedRectangle:Position(15 + (44.5 * ((self:CurrentSelection() - self.Data.Pagination.Min) - 1)) + ParentOffsetX +
2979 (ParentOffsetWidth / 2), 47 + Y)
2980 if self.EnableArrow ~= false then
2981 self.LeftArrow:Position(7.5 + ParentOffsetX + (ParentOffsetWidth / 2), 15 + Y)
2982 self.RightArrow:Position(393.5 + ParentOffsetX + (ParentOffsetWidth / 2), 15 + Y)
2983 end
2984 self.Text:Position(215.5 + ParentOffsetX + (ParentOffsetWidth / 2), 15 + Y)
2985 end
2986 end
2987
2988 function UIMenuColourPanel:CurrentSelection(value, PreventUpdate)
2989 if tonumber(value) then
2990 if #self.Data.Items == 0 then self.Data.Index = 0 end
2991
2992 self.Data.Index = 1000000 - (1000000 % #self.Data.Items) + tonumber(value)
2993
2994 if self:CurrentSelection() > self.Data.Pagination.Max then
2995 self.Data.Pagination.Min = self:CurrentSelection() - (self.Data.Pagination.Total + 1)
2996 self.Data.Pagination.Max = self:CurrentSelection()
2997 elseif self:CurrentSelection() < self.Data.Pagination.Min then
2998 self.Data.Pagination.Min = self:CurrentSelection() - 1
2999 self.Data.Pagination.Max = self:CurrentSelection() + (self.Data.Pagination.Total + 1)
3000 end
3001
3002 self:UpdateSelection(PreventUpdate)
3003 else
3004 if #self.Data.Items == 0 then
3005 return 1
3006 else
3007 if self.Data.Index % #self.Data.Items == 0 then
3008 return 1
3009 else
3010 return self.Data.Index % #self.Data.Items + 1
3011 end
3012 end
3013 end
3014 end
3015
3016 function UIMenuColourPanel:UpdateParent(Colour)
3017 local _, ParentType = self.ParentItem()
3018 if ParentType == "UIMenuListItem" then
3019 local PanelItemIndex = self.ParentItem:FindPanelItem()
3020 local PanelIndex = self.ParentItem:FindPanelIndex(self)
3021 if PanelItemIndex then
3022 self.ParentItem.Items[PanelItemIndex].Value[PanelIndex] = Colour
3023 self.ParentItem:Index(PanelItemIndex)
3024 self.ParentItem.Base.ParentMenu.OnListChange(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3025 self.ParentItem.OnListChanged(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3026 else
3027 for Index = 1, #self.ParentItem.Items do
3028 if type(self.ParentItem.Items[Index]) == "table" then
3029 if not self.ParentItem.Items[Index].Panels then self.ParentItem.Items[Index].Panels = {} end
3030 self.ParentItem.Items[Index].Panels[PanelIndex] = Colour
3031 else
3032 self.ParentItem.Items[Index] = {
3033 Name = tostring(self.ParentItem.Items[Index]),
3034 Value = self.ParentItem.Items[Index],
3035 Panels = {[PanelIndex] = Colour}
3036 }
3037 end
3038 end
3039 self.ParentItem.Base.ParentMenu.OnListChange(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3040 self.ParentItem.OnListChanged(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3041 end
3042 elseif ParentType == "UIMenuItem" then
3043 self.ParentItem.ActivatedPanel(self.ParentItem.ParentMenu, self.ParentItem, self, Colour)
3044 end
3045 end
3046
3047 function UIMenuColourPanel:UpdateSelection(PreventUpdate)
3048 local CurrentSelection = self:CurrentSelection()
3049 if not PreventUpdate then self:UpdateParent(CurrentSelection) end
3050 self.SelectedRectangle:Position(15 + (44.5 * ((CurrentSelection - self.Data.Pagination.Min) - 1)) + self.ParentItem:Offset().X,
3051 self.SelectedRectangle.Y)
3052 for Index = 1, 9 do self.Bar[Index]:Colour(table.unpack(self.Data.Items[self.Data.Pagination.Min + Index])) end
3053 self.Text:Text(self.Data.Title .. " [" .. CurrentSelection .. " / " .. #self.Data.Items .. "]")
3054 end
3055
3056 function UIMenuColourPanel:Functions()
3057 local DrawOffset = {X = 0, Y = 0}
3058 if self.ParentItem:SetParentMenu().Settings.ScaleWithSafezone then DrawOffset = self.ParentItem:SetParentMenu().DrawOffset end
3059
3060 if IsDisabledControlJustPressed(0, 24) or IsDisabledControlJustPressed(0, 174) then self:GoLeft() end
3061 if IsDisabledControlJustPressed(0, 24) or IsDisabledControlJustPressed(0, 175) then self:GoRight() end
3062
3063 if IsMouseInBounds(self.LeftArrow.X, self.LeftArrow.Y, self.LeftArrow.Width, self.LeftArrow.Height, DrawOffset) then
3064 if IsDisabledControlJustPressed(0, 24) then self:GoLeft() end
3065 end
3066 if IsMouseInBounds(self.RightArrow.X, self.RightArrow.Y, self.RightArrow.Width, self.RightArrow.Height, DrawOffset) then
3067 if IsDisabledControlJustPressed(0, 24) then self:GoRight() end
3068 end
3069
3070 for Index = 1, #self.Bar do
3071 if IsMouseInBounds(self.Bar[Index].X, self.Bar[Index].Y, self.Bar[Index].Width, self.Bar[Index].Height, DrawOffset) then
3072 if IsDisabledControlJustPressed(0, 24) then self:CurrentSelection(self.Data.Pagination.Min + Index - 1) end
3073 end
3074 end
3075 end
3076
3077 function UIMenuColourPanel:GoLeft()
3078 if #self.Data.Items > self.Data.Pagination.Total + 1 then
3079 if self:CurrentSelection() <= self.Data.Pagination.Min + 1 then
3080 if self:CurrentSelection() == 1 then
3081 self.Data.Pagination.Min = #self.Data.Items - (self.Data.Pagination.Total + 1)
3082 self.Data.Pagination.Max = #self.Data.Items
3083 self.Data.Index = 1000 - (1000 % #self.Data.Items)
3084 self.Data.Index = self.Data.Index + (#self.Data.Items - 1)
3085 self:UpdateSelection()
3086 else
3087 self.Data.Pagination.Min = self.Data.Pagination.Min - 1
3088 self.Data.Pagination.Max = self.Data.Pagination.Max - 1
3089 self.Data.Index = self.Data.Index - 1
3090 self:UpdateSelection()
3091 end
3092 else
3093 self.Data.Index = self.Data.Index - 1
3094 self:UpdateSelection()
3095 end
3096 else
3097 self.Data.Index = self.Data.Index - 1
3098 self:UpdateSelection()
3099 end
3100 end
3101
3102 function UIMenuColourPanel:GoRight()
3103 if #self.Data.Items > self.Data.Pagination.Total + 1 then
3104 if self:CurrentSelection() >= self.Data.Pagination.Max then
3105 if self:CurrentSelection() == #self.Data.Items then
3106 self.Data.Pagination.Min = 0
3107 self.Data.Pagination.Max = self.Data.Pagination.Total + 1
3108 self.Data.Index = 1000 - (1000 % #self.Data.Items)
3109 self:UpdateSelection()
3110 else
3111 self.Data.Pagination.Max = self.Data.Pagination.Max + 1
3112 self.Data.Pagination.Min = self.Data.Pagination.Max - (self.Data.Pagination.Total + 1)
3113 self.Data.Index = self.Data.Index + 1
3114 self:UpdateSelection()
3115 end
3116 else
3117 self.Data.Index = self.Data.Index + 1
3118 self:UpdateSelection()
3119 end
3120 else
3121 self.Data.Index = self.Data.Index + 1
3122 self:UpdateSelection()
3123 end
3124 end
3125
3126 function UIMenuColourPanel:Draw()
3127 if self.Data.Enabled then
3128 self.Background:Size(431 + self.ParentItem:SetParentMenu().WidthOffset, 112)
3129 self.Background:Draw()
3130 if self.EnableArrow ~= false then
3131 self.LeftArrow:Draw()
3132 self.RightArrow:Draw()
3133 end
3134 self.Text:Draw()
3135 self.SelectedRectangle:Draw()
3136 for Index = 1, #self.Bar do self.Bar[Index]:Draw() end
3137 self:Functions()
3138 end
3139 end
3140end
3141
3142--==================================================================================================================================================--
3143--[[ NativeUI\UIMenu\panels\UIMenuGridPanel ]]
3144--==================================================================================================================================================--
3145UIMenuGridPanel = setmetatable({}, UIMenuGridPanel)
3146UIMenuGridPanel.__index = UIMenuGridPanel
3147UIMenuGridPanel.__call = function()
3148return "UIMenuPanel", "UIMenuGridPanel"
3149end
3150do
3151 function UIMenuGridPanel.New(TopText, LeftText, RightText, BottomText, CirclePositionX, CirclePositionY)
3152 local _UIMenuGridPanel = {
3153 Data = {
3154 Enabled = true,
3155 },
3156 Background = Sprite.New("commonmenu", "gradient_bgd", 0, 0, 431, 275),
3157 Grid = Sprite.New("pause_menu_pages_char_mom_dad", "nose_grid", 0, 0, 200, 200, 0, 255, 255, 255, 255),
3158 Circle = Sprite.New("mpinventory", "in_world_circle", 0, 0, 20, 20, 0),
3159 Audio = { Slider = "CONTINUOUS_SLIDER", Library = "HUD_FRONTEND_DEFAULT_SOUNDSET", Id = nil },
3160 ParentItem = nil,
3161 Text = {
3162 Top = UIResText.New(TopText or "Top", 0, 0, 0.35, 255, 255, 255, 255, 0, "Centre"),
3163 Left = UIResText.New(LeftText or "Left", 0, 0, 0.35, 255, 255, 255, 255, 0, "Centre"),
3164 Right = UIResText.New(RightText or "Right", 0, 0, 0.35, 255, 255, 255, 255, 0, "Centre"),
3165 Bottom = UIResText.New(BottomText or "Bottom", 0, 0, 0.35, 255, 255, 255, 255, 0, "Centre"),
3166 },
3167 SetCirclePosition = { X = CirclePositionX or 0.5, Y = CirclePositionY or 0.5 }
3168 }
3169 return setmetatable(_UIMenuGridPanel, UIMenuGridPanel)
3170 end
3171
3172 function UIMenuGridPanel:SetParentItem(Item)
3173 -- required
3174 if Item() == "UIMenuItem" then
3175 self.ParentItem = Item
3176 else
3177 return self.ParentItem
3178 end
3179 end
3180
3181 function UIMenuGridPanel:Enabled(Enabled)
3182 if type(Enabled) == "boolean" then
3183 self.Data.Enabled = Enabled
3184 else
3185 return self.Data.Enabled
3186 end
3187 end
3188
3189 function UIMenuGridPanel:CirclePosition(X, Y)
3190 if tonumber(X) and tonumber(Y) then
3191 self.Circle.X = (self.Grid.X + 20) + ((self.Grid.Width - 40) * ((X >= 0.0 and X <= 1.0) and X or 0.0)) - (self.Circle.Width / 2)
3192 self.Circle.Y = (self.Grid.Y + 20) + ((self.Grid.Height - 40) * ((Y >= 0.0 and Y <= 1.0) and Y or 0.0)) - (self.Circle.Height / 2)
3193 else
3194 return math.round((self.Circle.X - (self.Grid.X + 20) + (self.Circle.Width / 2)) / (self.Grid.Width - 40), 2), math.round((self.Circle.Y - (self.Grid.Y + 20) + (self.Circle.Height / 2)) / (self.Grid.Height - 40), 2)
3195 end
3196 end
3197
3198 function UIMenuGridPanel:Position(Y)
3199 if tonumber(Y) then
3200 local ParentOffsetX, ParentOffsetWidth = self.ParentItem:Offset().X, self.ParentItem:SetParentMenu().WidthOffset
3201 self.Background:Position(ParentOffsetX, Y)
3202 self.Grid:Position(ParentOffsetX + 115.5 + (ParentOffsetWidth / 2), 37.5 + Y)
3203 self.Text.Top:Position(ParentOffsetX + 215.5 + (ParentOffsetWidth / 2), 5 + Y)
3204 self.Text.Left:Position(ParentOffsetX + 57.75 + (ParentOffsetWidth / 2), 120 + Y)
3205 self.Text.Right:Position(ParentOffsetX + 373.25 + (ParentOffsetWidth / 2), 120 + Y)
3206 self.Text.Bottom:Position(ParentOffsetX + 215.5 + (ParentOffsetWidth / 2), 240 + Y)
3207 if not self.CircleLocked then
3208 self.CircleLocked = true
3209 self:CirclePosition(self.SetCirclePosition.X, self.SetCirclePosition.Y)
3210 end
3211 end
3212 end
3213
3214 function UIMenuGridPanel:UpdateParent(X, Y)
3215 local _, ParentType = self.ParentItem()
3216 self.Data.Value = { X = X, Y = Y }
3217 if ParentType == "UIMenuListItem" then
3218 local PanelItemIndex = self.ParentItem:FindPanelItem()
3219 if PanelItemIndex then
3220 self.ParentItem.Items[PanelItemIndex].Value[self.ParentItem:FindPanelIndex(self)] = { X = X, Y = Y }
3221 self.ParentItem:Index(PanelItemIndex)
3222 self.ParentItem.Base.ParentMenu.OnListChange(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3223 self.ParentItem.OnListChanged(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3224 else
3225 local PanelIndex = self.ParentItem:FindPanelIndex(self)
3226 for Index = 1, #self.ParentItem.Items do
3227 if type(self.ParentItem.Items[Index]) == "table" then
3228 if not self.ParentItem.Items[Index].Panels then
3229 self.ParentItem.Items[Index].Panels = {}
3230 end
3231 self.ParentItem.Items[Index].Panels[PanelIndex] = { X = X, Y = Y }
3232 else
3233 self.ParentItem.Items[Index] = { Name = tostring(self.ParentItem.Items[Index]), Value = self.ParentItem.Items[Index], Panels = { [PanelIndex] = { X = X, Y = Y } } }
3234 end
3235 end
3236 self.ParentItem.Base.ParentMenu.OnListChange(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3237 self.ParentItem.OnListChanged(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3238 self.ParentItem.Base.ActivatedPanel(self.ParentItem.ParentMenu, self.ParentItem, self, { X = X, Y = Y })
3239 end
3240 elseif ParentType == "UIMenuItem" then
3241 self.ParentItem.ActivatedPanel(self.ParentItem.ParentMenu, self.ParentItem, self, { X = X, Y = Y })
3242 end
3243 end
3244
3245 function UIMenuGridPanel:Functions()
3246 local DrawOffset = { X = 0, Y = 0 }
3247 if self.ParentItem:SetParentMenu().Settings.ScaleWithSafezone then
3248 DrawOffset = self.ParentItem:SetParentMenu().DrawOffset
3249 end
3250 if IsMouseInBounds(self.Grid.X + 20, self.Grid.Y + 20, self.Grid.Width - 40, self.Grid.Height - 40, DrawOffset) then
3251 if IsDisabledControlJustPressed(0, 24) then
3252 if not self.Pressed then
3253 self.Pressed = true
3254 Citizen.CreateThread(function()
3255 self.Audio.Id = GetSoundId()
3256 PlaySoundFrontend(self.Audio.Id, self.Audio.Slider, self.Audio.Library, 1)
3257 while IsDisabledControlPressed(0, 24) and IsMouseInBounds(self.Grid.X + 20, self.Grid.Y + 20, self.Grid.Width - 40, self.Grid.Height - 40, DrawOffset) do
3258 Citizen.Wait(0)
3259 local CursorX, CursorY = ConvertToPixel(GetControlNormal(0, 239) - DrawOffset.X, GetControlNormal(0, 240) - DrawOffset.Y)
3260 CursorX, CursorY = CursorX - (self.Circle.Width / 2), CursorY - (self.Circle.Height / 2)
3261 self.Circle:Position(((CursorX > (self.Grid.X + 10 + self.Grid.Width - 40)) and (self.Grid.X + 10 + self.Grid.Width - 40) or ((CursorX < (self.Grid.X + 20 - (self.Circle.Width / 2))) and (self.Grid.X + 20 - (self.Circle.Width / 2)) or CursorX)), ((CursorY > (self.Grid.Y + 10 + self.Grid.Height - 40)) and (self.Grid.Y + 10 + self.Grid.Height - 40) or ((CursorY < (self.Grid.Y + 20 - (self.Circle.Height / 2))) and (self.Grid.Y + 20 - (self.Circle.Height / 2)) or CursorY)))
3262 end
3263 StopSound(self.Audio.Id)
3264 ReleaseSoundId(self.Audio.Id)
3265 self.Pressed = false
3266 end)
3267 Citizen.CreateThread(function()
3268 while IsDisabledControlPressed(0, 24) and IsMouseInBounds(self.Grid.X + 20, self.Grid.Y + 20, self.Grid.Width - 40, self.Grid.Height - 40, DrawOffset) do
3269 Citizen.Wait(75)
3270 local ResultX, ResultY = math.round((self.Circle.X - (self.Grid.X + 20) + (self.Circle.Width / 2)) / (self.Grid.Width - 40), 2), math.round((self.Circle.Y - (self.Grid.Y + 20) + (self.Circle.Height / 2)) / (self.Grid.Height - 40), 2)
3271
3272 self:UpdateParent((((ResultX >= 0.0 and ResultX <= 1.0) and ResultX or ((ResultX <= 0) and 0.0) or 1.0) * 2) - 1, (((ResultY >= 0.0 and ResultY <= 1.0) and ResultY or ((ResultY <= 0) and 0.0) or 1.0) * 2) - 1)
3273 end
3274 end)
3275 end
3276 end
3277 end
3278 end
3279
3280 function UIMenuGridPanel:Draw()
3281 if self.Data.Enabled then
3282 self.Background:Size(431 + self.ParentItem:SetParentMenu().WidthOffset, 275)
3283 self.Background:Draw()
3284 self.Grid:Draw()
3285 self.Circle:Draw()
3286 self.Text.Top:Draw()
3287 self.Text.Left:Draw()
3288 self.Text.Right:Draw()
3289 self.Text.Bottom:Draw()
3290 self:Functions()
3291 end
3292 end
3293end
3294
3295--==================================================================================================================================================--
3296--[[ NativeUI\UIMenu\panels\UIMenuHorizontalOneLineGridPanel ]]
3297--==================================================================================================================================================--
3298UIMenuHorizontalOneLineGridPanel = setmetatable({}, UIMenuHorizontalOneLineGridPanel)
3299UIMenuHorizontalOneLineGridPanel.__index = UIMenuHorizontalOneLineGridPanel
3300UIMenuHorizontalOneLineGridPanel.__call = function()
3301return "UIMenuPanel", "UIMenuHorizontalOneLineGridPanel"
3302end
3303do
3304 function UIMenuHorizontalOneLineGridPanel.New(LeftText, RightText, CirclePositionX)
3305 local _UIMenuHorizontalOneLineGridPanel = {
3306 Data = {
3307 Enabled = true,
3308 },
3309 Background = Sprite.New("commonmenu", "gradient_bgd", 0, 0, 431, 275),
3310 Grid = Sprite.New("NativeUI", "horizontal_grid", 0, 0, 200, 200, 0, 255, 255, 255, 255),
3311 Circle = Sprite.New("mpinventory", "in_world_circle", 0, 0, 20, 20, 0),
3312 Audio = { Slider = "CONTINUOUS_SLIDER", Library = "HUD_FRONTEND_DEFAULT_SOUNDSET", Id = nil },
3313 ParentItem = nil,
3314 Text = {
3315 Left = UIResText.New(LeftText or "Left", 0, 0, 0.35, 255, 255, 255, 255, 0, "Centre"),
3316 Right = UIResText.New(RightText or "Right", 0, 0, 0.35, 255, 255, 255, 255, 0, "Centre"),
3317 },
3318 SetCirclePosition = { X = CirclePositionX or 0.5, Y = 0.5 }
3319 }
3320 return setmetatable(_UIMenuHorizontalOneLineGridPanel, UIMenuHorizontalOneLineGridPanel)
3321 end
3322
3323 function UIMenuHorizontalOneLineGridPanel:SetParentItem(Item)
3324 -- required
3325 if Item() == "UIMenuItem" then
3326 self.ParentItem = Item
3327 else
3328 return self.ParentItem
3329 end
3330 end
3331
3332 function UIMenuHorizontalOneLineGridPanel:Enabled(Enabled)
3333 if type(Enabled) == "boolean" then
3334 self.Data.Enabled = Enabled
3335 else
3336 return self.Data.Enabled
3337 end
3338 end
3339
3340 function UIMenuHorizontalOneLineGridPanel:CirclePosition(X, Y)
3341 if tonumber(X) and tonumber(Y) then
3342 self.Circle.X = (self.Grid.X + 20) + ((self.Grid.Width - 40) * ((X >= 0.0 and X <= 1.0) and X or 0.0)) - (self.Circle.Width / 2)
3343 self.Circle.Y = (self.Grid.Y + 20) + ((self.Grid.Height - 40) * ((Y >= 0.0 and Y <= 1.0) and Y or 0.0)) - (self.Circle.Height / 2)
3344 else
3345 return math.round((self.Circle.X - (self.Grid.X + 20) + (self.Circle.Width / 2)) / (self.Grid.Width - 40), 2), math.round((self.Circle.Y - (self.Grid.Y + 10) + (self.Circle.Height / 2)) / (self.Grid.Height - 40), 2)
3346 end
3347 end
3348
3349 function UIMenuHorizontalOneLineGridPanel:Position(Y)
3350 if tonumber(Y) then
3351 local ParentOffsetX, ParentOffsetWidth = self.ParentItem:Offset().X, self.ParentItem:SetParentMenu().WidthOffset
3352 self.Background:Position(ParentOffsetX, Y)
3353 self.Grid:Position(ParentOffsetX + 115.5 + (ParentOffsetWidth / 2), 37.5 + Y)
3354 self.Text.Left:Position(ParentOffsetX + 57.75 + (ParentOffsetWidth / 2), 120 + Y)
3355 self.Text.Right:Position(ParentOffsetX + 373.25 + (ParentOffsetWidth / 2), 120 + Y)
3356 if not self.CircleLocked then
3357 self.CircleLocked = true
3358 self:CirclePosition(self.SetCirclePosition.X, self.SetCirclePosition.Y)
3359 end
3360 end
3361 end
3362
3363 function UIMenuHorizontalOneLineGridPanel:UpdateParent(X)
3364 local _, ParentType = self.ParentItem()
3365 self.Data.Value = { X = X }
3366 if ParentType == "UIMenuListItem" then
3367 local PanelItemIndex = self.ParentItem:FindPanelItem()
3368 if PanelItemIndex then
3369 self.ParentItem.Items[PanelItemIndex].Value[self.ParentItem:FindPanelIndex(self)] = { X = X }
3370 self.ParentItem:Index(PanelItemIndex)
3371 self.ParentItem.Base.ParentMenu.OnListChange(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3372 self.ParentItem.OnListChanged(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3373 else
3374 local PanelIndex = self.ParentItem:FindPanelIndex(self)
3375 for Index = 1, #self.ParentItem.Items do
3376 if type(self.ParentItem.Items[Index]) == "table" then
3377 if not self.ParentItem.Items[Index].Panels then
3378 self.ParentItem.Items[Index].Panels = {}
3379 end
3380 self.ParentItem.Items[Index].Panels[PanelIndex] = { X = X }
3381 else
3382 self.ParentItem.Items[Index] = { Name = tostring(self.ParentItem.Items[Index]), Value = self.ParentItem.Items[Index], Panels = { [PanelIndex] = { X = X } } }
3383 end
3384 end
3385 self.ParentItem.Base.ParentMenu.OnListChange(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3386 self.ParentItem.OnListChanged(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3387 self.ParentItem.Base.ActivatedPanel(self.ParentItem.ParentMenu, self.ParentItem, self, { X = X })
3388 end
3389 elseif ParentType == "UIMenuItem" then
3390 self.ParentItem.ActivatedPanel(self.ParentItem.ParentMenu, self.ParentItem, self, { X = X })
3391 end
3392 end
3393
3394 function UIMenuHorizontalOneLineGridPanel:Functions()
3395 local DrawOffset = { X = 0, Y = 0}
3396 if self.ParentItem:SetParentMenu().Settings.ScaleWithSafezone then
3397 DrawOffset = self.ParentItem:SetParentMenu().DrawOffset
3398 end
3399 if IsMouseInBounds(self.Grid.X + 20, self.Grid.Y + 20, self.Grid.Width - 40, self.Grid.Height - 40, DrawOffset) then
3400 if IsDisabledControlJustPressed(0, 24) then
3401 if not self.Pressed then
3402 self.Pressed = true
3403 Citizen.CreateThread(function()
3404 self.Audio.Id = GetSoundId()
3405 PlaySoundFrontend(self.Audio.Id, self.Audio.Slider, self.Audio.Library, 1)
3406 while IsDisabledControlPressed(0, 24) and IsMouseInBounds(self.Grid.X + 20, self.Grid.Y + 20, self.Grid.Width - 10, self.Grid.Height - 10, DrawOffset) do
3407 Citizen.Wait(0)
3408 local CursorX, CursorY = ConvertToPixel(GetControlNormal(0, 239) - DrawOffset.X, GetControlNormal(0, 240) - DrawOffset.Y)
3409 CursorX, CursorY = CursorX - (self.Circle.Width / 2), CursorY - (self.Circle.Height / 2)
3410 local moveCursorX = (CursorX > (self.Grid.X + 10 + self.Grid.Width - 40)) and (self.Grid.X + 10 + self.Grid.Width - 40) or ((CursorX < (self.Grid.X + 20 - (self.Circle.Width / 2))) and (self.Grid.X + 20 - (self.Circle.Width / 2)) or CursorX)
3411 local moveCursorY = (CursorY > (self.Grid.Y + 10 + self.Grid.Height - 120)) and (self.Grid.Y + 10 + self.Grid.Height - 120) or ((CursorY < (self.Grid.Y + 100 - (self.Circle.Height / 2))) and (self.Grid.Y + 100 - (self.Circle.Height / 2)) or CursorY)
3412 self.Circle:Position(moveCursorX, moveCursorY)
3413 end
3414 StopSound(self.Audio.Id)
3415 ReleaseSoundId(self.Audio.Id)
3416 self.Pressed = false
3417 end)
3418 Citizen.CreateThread(function()
3419 while IsDisabledControlPressed(0, 24) and IsMouseInBounds(self.Grid.X + 20, self.Grid.Y + 20, self.Grid.Width - 40, self.Grid.Height - 40, DrawOffset) do
3420 Citizen.Wait(75)
3421 local ResultX = math.round((self.Circle.X - (self.Grid.X + 20) + (self.Circle.Width / 2)) / (self.Grid.Width - 40), 2)
3422 self:UpdateParent((((ResultX >= 0.0 and ResultX <= 1.0) and ResultX or ((ResultX <= 0) and 0.0) or 1.0) * 2) - 1)
3423 end
3424 end)
3425 end
3426 end
3427 end
3428 end
3429
3430 function UIMenuHorizontalOneLineGridPanel:Draw()
3431 if self.Data.Enabled then
3432 self.Background:Size(431 + self.ParentItem:SetParentMenu().WidthOffset, 275)
3433 self.Background:Draw()
3434 self.Grid:Draw()
3435 self.Circle:Draw()
3436 self.Text.Left:Draw()
3437 self.Text.Right:Draw()
3438 self:Functions()
3439 end
3440 end
3441end
3442
3443--==================================================================================================================================================--
3444--[[ NativeUI\UIMenu\panels\UIMenuPercentagePanel ]]
3445--==================================================================================================================================================--
3446UIMenuPercentagePanel = setmetatable({}, UIMenuPercentagePanel)
3447UIMenuPercentagePanel.__index = UIMenuPercentagePanel
3448UIMenuPercentagePanel.__call = function()
3449return "UIMenuPanel", "UIMenuPercentagePanel"
3450end
3451do
3452 function UIMenuPercentagePanel.New(MinText, MaxText)
3453 local _UIMenuPercentagePanel = {
3454 Data = {
3455 Enabled = true,
3456 },
3457 Background = Sprite.New("commonmenu", "gradient_bgd", 0, 0, 431, 76),
3458 ActiveBar = UIResRectangle.New(0, 0, 413, 10, 245, 245, 245, 255),
3459 BackgroundBar = UIResRectangle.New(0, 0, 413, 10, 87, 87, 87, 255),
3460 Text = {
3461 Min = UIResText.New(MinText or "0%", 0, 0, 0.35, 255, 255, 255, 255, 0, "Centre"),
3462 Max = UIResText.New("100%", 0, 0, 0.35, 255, 255, 255, 255, 0, "Centre"),
3463 Title = UIResText.New(MaxText or "Opacity", 0, 0, 0.35, 255, 255, 255, 255, 0, "Centre"),
3464 },
3465 Audio = { Slider = "CONTINUOUS_SLIDER", Library = "HUD_FRONTEND_DEFAULT_SOUNDSET", Id = nil },
3466 ParentItem = nil,
3467 }
3468
3469 return setmetatable(_UIMenuPercentagePanel, UIMenuPercentagePanel)
3470 end
3471
3472 function UIMenuPercentagePanel:SetParentItem(Item)
3473 if Item() == "UIMenuItem" then
3474 self.ParentItem = Item
3475 else
3476 return self.ParentItem
3477 end
3478 end
3479
3480 function UIMenuPercentagePanel:Enabled(Enabled)
3481 if type(Enabled) == "boolean" then
3482 self.Data.Enabled = Enabled
3483 else
3484 return self.Data.Enabled
3485 end
3486 end
3487
3488 function UIMenuPercentagePanel:Position(Y)
3489 if tonumber(Y) then
3490 local ParentOffsetX, ParentOffsetWidth = self.ParentItem:Offset().X, self.ParentItem:SetParentMenu().WidthOffset
3491 self.Background:Position(ParentOffsetX, Y)
3492 self.ActiveBar:Position(ParentOffsetX + (ParentOffsetWidth / 2) + 9, 50 + Y)
3493 self.BackgroundBar:Position(ParentOffsetX + (ParentOffsetWidth / 2) + 9, 50 + Y)
3494 self.Text.Min:Position(ParentOffsetX + (ParentOffsetWidth / 2) + 25, 15 + Y)
3495 self.Text.Max:Position(ParentOffsetX + (ParentOffsetWidth / 2) + 398, 15 + Y)
3496 self.Text.Title:Position(ParentOffsetX + (ParentOffsetWidth / 2) + 215.5, 15 + Y)
3497 end
3498 end
3499
3500 function UIMenuPercentagePanel:Percentage(Value)
3501 if tonumber(Value) then
3502 local Percent = ((Value < 0.0) and 0.0) or ((Value > 1.0) and 1.0 or Value)
3503 self.ActiveBar:Size(self.BackgroundBar.Width * Percent, self.ActiveBar.Height)
3504 else
3505 local DrawOffset = { X = 0, Y = 0}
3506 if self.ParentItem:SetParentMenu().Settings.ScaleWithSafezone then
3507 DrawOffset = self.ParentItem:SetParentMenu().DrawOffset
3508 end
3509
3510 local W, H = GetResolution()
3511 local Progress = (math.round((GetControlNormal(0, 239) - DrawOffset.X) * W)) - self.ActiveBar.X
3512 return math.round(((Progress >= 0 and Progress <= 413) and Progress or ((Progress < 0) and 0 or 413)) / self.BackgroundBar.Width, 2)
3513 end
3514 end
3515
3516 function UIMenuPercentagePanel:UpdateParent(Percentage)
3517 local _, ParentType = self.ParentItem()
3518 if ParentType == "UIMenuListItem" then
3519 local PanelItemIndex = self.ParentItem:FindPanelItem()
3520 if PanelItemIndex then
3521 self.ParentItem.Items[PanelItemIndex].Value[self.ParentItem:FindPanelIndex(self)] = Percentage
3522 self.ParentItem:Index(PanelItemIndex)
3523 self.ParentItem.Base.ParentMenu.OnListChange(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3524 self.ParentItem.OnListChanged(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3525 else
3526 local PanelIndex = self.ParentItem:FindPanelIndex(self)
3527 for Index = 1, #self.ParentItem.Items do
3528 if type(self.ParentItem.Items[Index]) == "table" then
3529 if not self.ParentItem.Items[Index].Panels then
3530 self.ParentItem.Items[Index].Panels = {}
3531 end
3532 self.ParentItem.Items[Index].Panels[PanelIndex] = Percentage
3533 else
3534 self.ParentItem.Items[Index] = { Name = tostring(self.ParentItem.Items[Index]), Value = self.ParentItem.Items[Index], Panels = { [PanelIndex] = Percentage } }
3535 end
3536 end
3537 self.ParentItem.Base.ParentMenu.OnListChange(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3538 self.ParentItem.OnListChanged(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3539 end
3540 elseif ParentType == "UIMenuItem" then
3541 self.ParentItem.ActivatedPanel(self.ParentItem.ParentMenu, self.ParentItem, self, Percentage)
3542 end
3543 end
3544
3545 function UIMenuPercentagePanel:Functions()
3546 local DrawOffset = { X = 0, Y = 0}
3547 if self.ParentItem:SetParentMenu().Settings.ScaleWithSafezone then
3548 DrawOffset = self.ParentItem:SetParentMenu().DrawOffset
3549 end
3550 if IsMouseInBounds(self.BackgroundBar.X, self.BackgroundBar.Y - 4, self.BackgroundBar.Width, self.BackgroundBar.Height + 8, DrawOffset) then
3551 if IsDisabledControlJustPressed(0, 24) then
3552 if not self.Pressed then
3553 self.Pressed = true
3554 Citizen.CreateThread(function()
3555 self.Audio.Id = GetSoundId()
3556 PlaySoundFrontend(self.Audio.Id, self.Audio.Slider, self.Audio.Library, 1)
3557 while IsDisabledControlPressed(0, 24) and IsMouseInBounds(self.BackgroundBar.X, self.BackgroundBar.Y - 4, self.BackgroundBar.Width, self.BackgroundBar.Height + 8, DrawOffset) do
3558 Citizen.Wait(0)
3559 local Progress, ProgressY = ConvertToPixel(GetControlNormal(0, 239) - DrawOffset.X, 0)
3560 Progress = Progress - self.ActiveBar.X
3561 self.ActiveBar:Size(((Progress >= 0 and Progress <= 413) and Progress or ((Progress < 0) and 0 or 413)), self.ActiveBar.Height)
3562 end
3563 StopSound(self.Audio.Id)
3564 ReleaseSoundId(self.Audio.Id)
3565 self.Pressed = false
3566 end)
3567 Citizen.CreateThread(function()
3568 while IsDisabledControlPressed(0, 24) and IsMouseInBounds(self.BackgroundBar.X, self.BackgroundBar.Y - 4, self.BackgroundBar.Width, self.BackgroundBar.Height + 8, DrawOffset) do
3569 Citizen.Wait(75)
3570 local Progress, ProgressY = ConvertToPixel(GetControlNormal(0, 239) - DrawOffset.X, 0)
3571 Progress = Progress - self.ActiveBar.X
3572 self:UpdateParent(math.round(((Progress >= 0 and Progress <= 413) and Progress or ((Progress < 0) and 0 or 413)) / self.BackgroundBar.Width, 2))
3573 end
3574 end)
3575 end
3576 end
3577 end
3578 end
3579
3580 function UIMenuPercentagePanel:Draw()
3581 if self.Data.Enabled then
3582 self.Background:Size(431 + self.ParentItem:SetParentMenu().WidthOffset, 76)
3583 self.Background:Draw()
3584 self.BackgroundBar:Draw()
3585 self.ActiveBar:Draw()
3586 self.Text.Min:Draw()
3587 self.Text.Max:Draw()
3588 self.Text.Title:Draw()
3589 self:Functions()
3590 end
3591 end
3592end
3593
3594--==================================================================================================================================================--
3595--[[ NativeUI\UIMenu\panels\UIMenuStatisticsPanel ]]
3596--==================================================================================================================================================--
3597UIMenuStatisticsPanel = setmetatable({}, UIMenuStatisticsPanel)
3598UIMenuStatisticsPanel.__index = UIMenuStatisticsPanel
3599UIMenuStatisticsPanel.__call = function() return "UIMenuPanel", "UIMenuStatisticsPanel" end
3600do
3601 function UIMenuStatisticsPanel.New()
3602 local _UIMenuStatisticsPanel = {
3603 Background = UIResRectangle.New(0, 0, 431, 47, 0, 0, 0, 170),
3604 Divider = true,
3605 ParentItem = nil,
3606 Items = {}
3607 }
3608 return setmetatable(_UIMenuStatisticsPanel, UIMenuStatisticsPanel)
3609 end
3610
3611 function UIMenuStatisticsPanel:AddStatistics(Name)
3612 local Items = {
3613 Text = UIResText.New(Name or "", 0, 0, 0.35, 255, 255, 255, 255, 0, "Left"),
3614 BackgroundProgressBar = UIResRectangle.New(0, 0, 200, 10, 255, 255, 255, 100),
3615 ProgressBar = UIResRectangle.New(0, 0, 100, 10, 255, 255, 255, 255),
3616 Divider = {
3617 [1] = UIResRectangle.New(0, 0, 2, 10, 0, 0, 0, 255),
3618 [2] = UIResRectangle.New(0, 0, 2, 10, 0, 0, 0, 255),
3619 [3] = UIResRectangle.New(0, 0, 2, 10, 0, 0, 0, 255),
3620 [4] = UIResRectangle.New(0, 0, 2, 10, 0, 0, 0, 255),
3621 [5] = UIResRectangle.New(0, 0, 2, 10, 0, 0, 0, 255)
3622 }
3623 }
3624 table.insert(self.Items, Items)
3625 end
3626
3627 function UIMenuStatisticsPanel:SetParentItem(Item)
3628 if Item() == "UIMenuItem" then
3629 self.ParentItem = Item
3630 else
3631 return self.ParentItem
3632 end
3633 end
3634
3635 function UIMenuStatisticsPanel:SetPercentage(ItemID, Number)
3636 if ItemID ~= nil then
3637 if Number <= 0 then
3638 self.Items[ItemID].ProgressBar.Width = 0
3639 else
3640 if Number <= 100 then
3641 self.Items[ItemID].ProgressBar.Width = Number * 2.0
3642 else
3643 self.Items[ItemID].ProgressBar.Width = 100 * 2.0
3644 end
3645 end
3646 else
3647 error("Missing arguments, ItemID")
3648 end
3649 end
3650
3651 function UIMenuStatisticsPanel:GetPercentage(ItemID)
3652 if ItemID ~= nil then
3653 return self.Items[ItemID].ProgressBar.Width * 2.0
3654 else
3655 error("Missing arguments, ItemID")
3656 end
3657 end
3658
3659 function UIMenuStatisticsPanel:Position(Y)
3660 if tonumber(Y) then
3661 local ParentOffsetX, ParentOffsetWidth = self.ParentItem:Offset().X, self.ParentItem:SetParentMenu().WidthOffset
3662 self.Background:Position(ParentOffsetX, Y)
3663 for i = 1, #self.Items do
3664 local OffsetItemCount = 40 * i
3665 self.Items[i].Text:Position(ParentOffsetX + (ParentOffsetWidth / 2) + 13, Y - 34 + OffsetItemCount)
3666 self.Items[i].BackgroundProgressBar:Position(ParentOffsetX + (ParentOffsetWidth / 2) + 200, Y - 22 + OffsetItemCount)
3667 self.Items[i].ProgressBar:Position(ParentOffsetX + (ParentOffsetWidth / 2) + 200, Y - 22 + OffsetItemCount)
3668 if self.Divider ~= false then
3669 for _ = 1, #self.Items[i].Divider, 1 do
3670 local DividerOffsetWidth = _ * 40
3671 self.Items[i].Divider[_]:Position(ParentOffsetX + (ParentOffsetWidth / 2) + 200 + DividerOffsetWidth,
3672 Y - 22 + OffsetItemCount)
3673 self.Background:Size(431 + self.ParentItem:SetParentMenu().WidthOffset, 47 + OffsetItemCount - 39)
3674 end
3675 end
3676 end
3677 end
3678 end
3679
3680 function UIMenuStatisticsPanel:Draw()
3681 self.Background:Draw()
3682 for i = 1, #self.Items do
3683 self.Items[i].Text:Draw()
3684 self.Items[i].BackgroundProgressBar:Draw()
3685 self.Items[i].ProgressBar:Draw()
3686 for _ = 1, #self.Items[i].Divider do self.Items[i].Divider[_]:Draw() end
3687 end
3688 end
3689end
3690
3691--==================================================================================================================================================--
3692--[[ NativeUI\UIMenu\panels\UIMenuVerticalOneLineGridPanel ]]
3693--==================================================================================================================================================--
3694UIMenuVerticalOneLineGridPanel = setmetatable({}, UIMenuVerticalOneLineGridPanel)
3695UIMenuVerticalOneLineGridPanel.__index = UIMenuVerticalOneLineGridPanel
3696UIMenuVerticalOneLineGridPanel.__call = function()
3697return "UIMenuPanel", "UIMenuVerticalOneLineGridPanel"
3698end
3699do
3700 function UIMenuVerticalOneLineGridPanel.New(TopText, BottomText, CirclePositionY)
3701 local _UIMenuVerticalOneLineGridPanel = {
3702 Data = {
3703 Enabled = true,
3704 },
3705 Background = Sprite.New("commonmenu", "gradient_bgd", 0, 0, 431, 275),
3706 Grid = Sprite.New("NativeUI", "vertical_grid", 0, 0, 200, 200, 0, 255, 255, 255, 255),
3707 Circle = Sprite.New("mpinventory", "in_world_circle", 0, 0, 20, 20, 0),
3708 Audio = { Slider = "CONTINUOUS_SLIDER", Library = "HUD_FRONTEND_DEFAULT_SOUNDSET", Id = nil },
3709 ParentItem = nil,
3710 Text = {
3711 Top = UIResText.New(TopText or "Top", 0, 0, 0.35, 255, 255, 255, 255, 0, "Centre"),
3712 Bottom = UIResText.New(BottomText or "Bottom", 0, 0, 0.35, 255, 255, 255, 255, 0, "Centre"),
3713 },
3714 SetCirclePosition = { X = 0.5, Y = CirclePositionY or 0.5 }
3715 }
3716 return setmetatable(_UIMenuVerticalOneLineGridPanel, UIMenuVerticalOneLineGridPanel)
3717 end
3718
3719 function UIMenuVerticalOneLineGridPanel:SetParentItem(Item)
3720 if Item() == "UIMenuItem" then
3721 self.ParentItem = Item
3722 else
3723 return self.ParentItem
3724 end
3725 end
3726
3727 function UIMenuVerticalOneLineGridPanel:Enabled(Enabled)
3728 if type(Enabled) == "boolean" then
3729 self.Data.Enabled = Enabled
3730 else
3731 return self.Data.Enabled
3732 end
3733 end
3734
3735 function UIMenuVerticalOneLineGridPanel:CirclePosition(X, Y)
3736 if tonumber(X) and tonumber(Y) then
3737 self.Circle.X = (self.Grid.X + 20) + ((self.Grid.Width - 40) * ((X >= 0.0 and X <= 1.0) and X or 0.0)) - (self.Circle.Width / 2)
3738 self.Circle.Y = (self.Grid.Y + 20) + ((self.Grid.Height - 40) * ((Y >= 0.0 and Y <= 1.0) and Y or 0.0)) - (self.Circle.Height / 2)
3739 else
3740 return math.round((self.Circle.X - (self.Grid.X + 20) + (self.Circle.Width / 2)) / (self.Grid.Width - 40), 2), math.round((self.Circle.Y - (self.Grid.Y + 20) + (self.Circle.Height / 2)) / (self.Grid.Height - 40), 2)
3741 end
3742 end
3743
3744 function UIMenuVerticalOneLineGridPanel:Position(Y)
3745 if tonumber(Y) then
3746 local ParentOffsetX, ParentOffsetWidth = self.ParentItem:Offset().X, self.ParentItem:SetParentMenu().WidthOffset
3747 self.Background:Position(ParentOffsetX, Y)
3748 self.Grid:Position(ParentOffsetX + 115.5 + (ParentOffsetWidth / 2), 37.5 + Y)
3749 self.Text.Top:Position(ParentOffsetX + 215.5 + (ParentOffsetWidth / 2), 5 + Y)
3750 self.Text.Bottom:Position(ParentOffsetX + 215.5 + (ParentOffsetWidth / 2), 240 + Y)
3751 if not self.CircleLocked then
3752 self.CircleLocked = true
3753 self:CirclePosition(self.SetCirclePosition.X, self.SetCirclePosition.Y)
3754 end
3755 end
3756 end
3757
3758 function UIMenuVerticalOneLineGridPanel:UpdateParent(Y)
3759 local _, ParentType = self.ParentItem()
3760 self.Data.Value = { Y = Y }
3761 if ParentType == "UIMenuListItem" then
3762 local PanelItemIndex = self.ParentItem:FindPanelItem()
3763 if PanelItemIndex then
3764 self.ParentItem.Items[PanelItemIndex].Value[self.ParentItem:FindPanelIndex(self)] = { Y = Y }
3765 self.ParentItem:Index(PanelItemIndex)
3766 self.ParentItem.Base.ParentMenu.OnListChange(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3767 self.ParentItem.OnListChanged(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3768 else
3769 local PanelIndex = self.ParentItem:FindPanelIndex(self)
3770 for Index = 1, #self.ParentItem.Items do
3771 if type(self.ParentItem.Items[Index]) == "table" then
3772 if not self.ParentItem.Items[Index].Panels then
3773 self.ParentItem.Items[Index].Panels = {}
3774 end
3775 self.ParentItem.Items[Index].Panels[PanelIndex] = { Y = Y }
3776 else
3777 self.ParentItem.Items[Index] = { Name = tostring(self.ParentItem.Items[Index]), Value = self.ParentItem.Items[Index], Panels = { [PanelIndex] = { Y = Y } } }
3778 end
3779 end
3780 self.ParentItem.Base.ParentMenu.OnListChange(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3781 self.ParentItem.OnListChanged(self.ParentItem.Base.ParentMenu, self.ParentItem, self.ParentItem._Index)
3782 self.ParentItem.Base.ActivatedPanel(self.ParentItem.ParentMenu, self.ParentItem, self, { Y = Y })
3783 end
3784 elseif ParentType == "UIMenuItem" then
3785 self.ParentItem.ActivatedPanel(self.ParentItem.ParentMenu, self.ParentItem, self, { Y = Y })
3786 end
3787 end
3788
3789 function UIMenuVerticalOneLineGridPanel:Functions()
3790 local DrawOffset = { X = 0, Y = 0}
3791 if self.ParentItem:SetParentMenu().Settings.ScaleWithSafezone then
3792 DrawOffset = self.ParentItem:SetParentMenu().DrawOffset
3793 end
3794
3795 if IsMouseInBounds(self.Grid.X + 20, self.Grid.Y + 20, self.Grid.Width - 40, self.Grid.Height - 40, DrawOffset) then
3796 if IsDisabledControlJustPressed(0, 24) then
3797 if not self.Pressed then
3798 self.Pressed = true
3799 Citizen.CreateThread(function()
3800 self.Audio.Id = GetSoundId()
3801 PlaySoundFrontend(self.Audio.Id, self.Audio.Slider, self.Audio.Library, 1)
3802 while IsDisabledControlPressed(0, 24) and IsMouseInBounds(self.Grid.X + 20, self.Grid.Y + 20, self.Grid.Width - 40, self.Grid.Height - 40, DrawOffset) do
3803 Citizen.Wait(0)
3804 local CursorX, CursorY = ConvertToPixel(GetControlNormal(0, 239) - DrawOffset.X, GetControlNormal(0, 240) - DrawOffset.Y)
3805 CursorX, CursorY = CursorX - (self.Circle.Width / 2), CursorY - (self.Circle.Height / 2)
3806 local moveCursorX = ((CursorX > (self.Grid.X + 10 + self.Grid.Width - 120)) and (self.Grid.X + 10 + self.Grid.Width - 120) or ((CursorX < (self.Grid.X + 100 - (self.Circle.Width / 2))) and (self.Grid.X + 100 - (self.Circle.Width / 2)) or CursorX))
3807 local moveCursorY = ((CursorY > (self.Grid.Y + 10 + self.Grid.Height - 40)) and (self.Grid.Y + 10 + self.Grid.Height - 40) or ((CursorY < (self.Grid.Y + 20 - (self.Circle.Height / 2))) and (self.Grid.Y + 20 - (self.Circle.Height / 2)) or CursorY))
3808 self.Circle:Position(moveCursorX, moveCursorY)
3809 end
3810 StopSound(self.Audio.Id)
3811 ReleaseSoundId(self.Audio.Id)
3812 self.Pressed = false
3813 end)
3814 Citizen.CreateThread(function()
3815 while IsDisabledControlPressed(0, 24) and IsMouseInBounds(self.Grid.X + 20, self.Grid.Y + 20, self.Grid.Width - 40, self.Grid.Height - 40, DrawOffset) do
3816 Citizen.Wait(75)
3817 local ResultY = math.round((self.Circle.Y - (self.Grid.Y + 20) + (self.Circle.Height / 2)) / (self.Grid.Height - 40), 2)
3818 self:UpdateParent((((ResultY >= 0.0 and ResultY <= 1.0) and ResultY or ((ResultY <= 0) and 0.0) or 1.0) * 2) - 1)
3819 end
3820 end)
3821 end
3822 end
3823 end
3824 end
3825
3826 function UIMenuVerticalOneLineGridPanel:Draw()
3827 if self.Data.Enabled then
3828 self.Background:Size(431 + self.ParentItem:SetParentMenu().WidthOffset, 275)
3829 self.Background:Draw()
3830 self.Grid:Draw()
3831 self.Circle:Draw()
3832 self.Text.Top:Draw()
3833 self.Text.Bottom:Draw()
3834 self:Functions()
3835 end
3836 end
3837end
3838
3839--==================================================================================================================================================--
3840--[[ NativeUI\UIMenu\winows\UIMenuHeritageWindow ]]
3841--==================================================================================================================================================--
3842UIMenuHeritageWindow = setmetatable({}, UIMenuHeritageWindow)
3843UIMenuHeritageWindow.__index = UIMenuHeritageWindow
3844UIMenuHeritageWindow.__call = function() return "UIMenuWindow", "UIMenuHeritageWindow" end
3845do
3846 function UIMenuHeritageWindow.New(Mum, Dad)
3847 if not tonumber(Mum) then Mum = 0 end
3848 if not (Mum >= 0 and Mum <= 21) then Mum = 0 end
3849 if not tonumber(Dad) then Dad = 0 end
3850 if not (Dad >= 0 and Dad <= 23) then Dad = 0 end
3851 local _UIMenuHeritageWindow = {
3852 Background = Sprite.New("pause_menu_pages_char_mom_dad", "mumdadbg", 0, 0, 431, 228), -- Background is required, must be a sprite or a rectangle.
3853 MumSprite = Sprite.New("char_creator_portraits", ((Mum < 21) and "female_" .. Mum or "special_female_" .. (tonumber(string.sub(Mum, 2, 2)) - 1)), 0, 0, 228, 228),
3854 DadSprite = Sprite.New("char_creator_portraits", ((Dad < 21) and "male_" .. Dad or "special_male_" .. (tonumber(string.sub(Dad, 2, 2)) - 1)), 0, 0, 228, 228),
3855 Mum = Mum,
3856 Dad = Dad,
3857 _Offset = {X = 0, Y = 0},
3858 ParentMenu = nil
3859 }
3860 return setmetatable(_UIMenuHeritageWindow, UIMenuHeritageWindow)
3861 end
3862
3863 function UIMenuHeritageWindow:SetParentMenu(Menu)
3864 -- required
3865 if Menu() == "UIMenu" then
3866 self.ParentMenu = Menu
3867 else
3868 return self.ParentMenu
3869 end
3870 end
3871
3872 function UIMenuHeritageWindow:Offset(X, Y)
3873 if tonumber(X) or tonumber(Y) then
3874 if tonumber(X) then self._Offset.X = tonumber(X) end
3875 if tonumber(Y) then self._Offset.Y = tonumber(Y) end
3876 else
3877 return self._Offset
3878 end
3879 end
3880
3881 function UIMenuHeritageWindow:Position(Y)
3882 if tonumber(Y) then
3883 self.Background:Position(self._Offset.X, 144 + Y + self._Offset.Y)
3884 self.MumSprite:Position(self._Offset.X + (self.ParentMenu.WidthOffset / 2) + 25, 144 + Y + self._Offset.Y)
3885 self.DadSprite:Position(self._Offset.X + (self.ParentMenu.WidthOffset / 2) + 195, 144 + Y + self._Offset.Y)
3886 end
3887 end
3888
3889 function UIMenuHeritageWindow:Index(Mum, Dad)
3890 if not tonumber(Mum) then Mum = self.Mum end
3891 if not (Mum >= 0 and Mum <= 21) then Mum = self.Mum end
3892 if not tonumber(Dad) then Dad = self.Dad end
3893 if not (Dad >= 0 and Dad <= 23) then Dad = self.Dad end
3894 self.Mum = Mum
3895 self.Dad = Dad
3896 self.MumSprite.TxtName = ((self.Mum < 21) and "female_" .. self.Mum or "special_female_" .. (tonumber(string.sub(Mum, 2, 2)) - 1))
3897 self.DadSprite.TxtName = ((self.Dad < 21) and "male_" .. self.Dad or "special_male_" .. (tonumber(string.sub(Dad, 2, 2)) - 1))
3898 end
3899
3900 function UIMenuHeritageWindow:Draw()
3901 self.Background:Size(431 + self.ParentMenu.WidthOffset, 228)
3902 self.Background:Draw()
3903 self.DadSprite:Draw()
3904 self.MumSprite:Draw()
3905 end
3906end
3907
3908--==================================================================================================================================================--
3909--[[ NativeUI\UIMenu ]]
3910--==================================================================================================================================================--
3911UIMenu = setmetatable({}, UIMenu)
3912UIMenu.__index = UIMenu
3913UIMenu.__call = function() return "UIMenu" end
3914do
3915 function UIMenu.New(Title, Subtitle, X, Y, TxtDictionary, TxtName, Heading, R, G, B, A)
3916 X, Y = tonumber(X) or 0, tonumber(Y) or 0
3917 if Title ~= nil then
3918 Title = tostring(Title) or ""
3919 else
3920 Title = ""
3921 end
3922 if Subtitle ~= nil then
3923 Subtitle = tostring(Subtitle) or ""
3924 else
3925 Subtitle = ""
3926 end
3927 if TxtDictionary ~= nil then
3928 TxtDictionary = tostring(TxtDictionary) or "commonmenu"
3929 else
3930 TxtDictionary = "commonmenu"
3931 end
3932 if TxtName ~= nil then
3933 TxtName = tostring(TxtName) or "interaction_bgd"
3934 else
3935 TxtName = "interaction_bgd"
3936 end
3937 if Heading ~= nil then
3938 Heading = tonumber(Heading) or 0
3939 else
3940 Heading = 0
3941 end
3942 if R ~= nil then
3943 R = tonumber(R) or 255
3944 else
3945 R = 255
3946 end
3947 if G ~= nil then
3948 G = tonumber(G) or 255
3949 else
3950 G = 255
3951 end
3952 if B ~= nil then
3953 B = tonumber(B) or 255
3954 else
3955 B = 255
3956 end
3957 if A ~= nil then
3958 A = tonumber(A) or 255
3959 else
3960 A = 255
3961 end
3962
3963 local _UIMenu = {
3964 Logo = Sprite.New(TxtDictionary, TxtName, 0 + X, 0 + Y, 431, 107, Heading, R, G, B, A),
3965 Banner = nil,
3966 Title = UIResText.New(Title, 215 + X, 20 + Y, 1.15, 255, 255, 255, 255, 1, 1, 0),
3967 BetterSize = true,
3968 Subtitle = {ExtraY = 0},
3969 WidthOffset = 0,
3970 Position = {X = X, Y = Y},
3971 DrawOffset = {X = 0, Y = 0},
3972 Pagination = {Min = 0, Max = 10, Total = 9},
3973 PageCounter = {isCustom = false, PreText = ""},
3974 Extra = {},
3975 Description = {},
3976 Items = {},
3977 Windows = {},
3978 Children = {},
3979 Controls = {
3980 Back = {Enabled = true},
3981 Select = {Enabled = true},
3982 Left = {Enabled = true},
3983 Right = {Enabled = true},
3984 Up = {Enabled = true},
3985 Down = {Enabled = true}
3986 },
3987 ParentMenu = nil,
3988 ParentItem = nil,
3989 _Visible = false,
3990 ActiveItem = 1000,
3991 Dirty = false,
3992 ReDraw = true,
3993 InstructionalScaleform = RequestScaleformMovie("INSTRUCTIONAL_BUTTONS"),
3994 InstructionalButtons = {},
3995 OnIndexChange = function(menu, newindex) end,
3996 OnListChange = function(menu, list, newindex) end,
3997 OnSliderChange = function(menu, slider, newindex) end,
3998 OnProgressChange = function(menu, progress, newindex) end,
3999 OnCheckboxChange = function(menu, item, checked) end,
4000 OnListSelect = function(menu, list, index) end,
4001 OnSliderSelect = function(menu, slider, index) end,
4002 OnProgressSelect = function(menu, progress, index) end,
4003 OnItemSelect = function(menu, item, index) end,
4004 OnMenuChanged = function(menu, newmenu, forward) end,
4005 OnMenuClosed = function(menu) end,
4006 Settings = {
4007 InstructionalButtons = true,
4008 MultilineFormats = true,
4009 ScaleWithSafezone = true,
4010 ResetCursorOnOpen = true,
4011 MouseControlsEnabled = true,
4012 MouseEdgeEnabled = true,
4013 ControlDisablingEnabled = true,
4014 DrawOrder = nil,
4015 Audio = {
4016 Library = "HUD_FRONTEND_DEFAULT_SOUNDSET",
4017 UpDown = "NAV_UP_DOWN",
4018 LeftRight = "NAV_LEFT_RIGHT",
4019 Select = "SELECT",
4020 Back = "BACK",
4021 Error = "ERROR"
4022 },
4023 EnabledControls = {
4024 Controller = {
4025 {0, 2}, -- Look Up and Down
4026 {0, 1}, -- Look Left and Right
4027 {0, 25}, -- Aim
4028 {0, 24} -- Attack
4029 },
4030 Keyboard = {
4031 {0, 201}, -- Select
4032 {0, 195}, -- X axis
4033 {0, 196}, -- Y axis
4034 {0, 187}, -- Down
4035 {0, 188}, -- Up
4036 {0, 189}, -- Left
4037 {0, 190}, -- Right
4038 {0, 202}, -- Back
4039 {0, 217}, -- Select
4040 {0, 242}, -- Scroll down
4041 {0, 241}, -- Scroll up
4042 {0, 239}, -- Cursor X
4043 {0, 240}, -- Cursor Y
4044 {0, 31}, -- Move Up and Down
4045 {0, 30}, -- Move Left and Right
4046 {0, 21}, -- Sprint
4047 {0, 22}, -- Jump
4048 {0, 23}, -- Enter
4049 {0, 75}, -- Exit Vehicle
4050 {0, 71}, -- Accelerate Vehicle
4051 {0, 72}, -- Vehicle Brake
4052 {0, 59}, -- Move Vehicle Left and Right
4053 {0, 89}, -- Fly Yaw Left
4054 {0, 9}, -- Fly Left and Right
4055 {0, 8}, -- Fly Up and Down
4056 {0, 90}, -- Fly Yaw Right
4057 {0, 76} -- Vehicle Handbrake
4058 }
4059 }
4060 }
4061 }
4062
4063 if Subtitle ~= "" and Subtitle ~= nil then
4064 _UIMenu.Subtitle.Rectangle = UIResRectangle.New(0 + _UIMenu.Position.X, 107 + _UIMenu.Position.Y, 431, 37, 0, 0, 0, 255)
4065 _UIMenu.Subtitle.Text = UIResText.New(Subtitle, 8 + _UIMenu.Position.X, 110 + _UIMenu.Position.Y, 0.35, 245, 245, 245, 255, 0)
4066 _UIMenu.Subtitle.BackupText = Subtitle
4067 _UIMenu.Subtitle.Formatted = false
4068 if string.starts(Subtitle, "~") then _UIMenu.PageCounter.PreText = string.sub(Subtitle, 1, 3) end
4069 _UIMenu.PageCounter.Text = UIResText.New("", 425 + _UIMenu.Position.X, 110 + _UIMenu.Position.Y, 0.35, 245, 245, 245, 255, 0, "Right")
4070 _UIMenu.Subtitle.ExtraY = 37
4071 end
4072
4073 _UIMenu.ArrowSprite = Sprite.New("commonmenu", "shop_arrows_upanddown", 190 + _UIMenu.Position.X, 147 + 37 * (_UIMenu.Pagination.Total + 1) + _UIMenu.Position.Y - 37 + _UIMenu.Subtitle.ExtraY, 40, 40)
4074 _UIMenu.Extra.Up = UIResRectangle.New(0 + _UIMenu.Position.X, 144 + 38 * (_UIMenu.Pagination.Total + 1) + _UIMenu.Position.Y - 37 + _UIMenu.Subtitle.ExtraY, 431, 18, 0, 0, 0, 200)
4075 _UIMenu.Extra.Down = UIResRectangle.New(0 + _UIMenu.Position.X, 144 + 18 + 38 * (_UIMenu.Pagination.Total + 1) + _UIMenu.Position.Y - 37 + _UIMenu.Subtitle.ExtraY, 431, 18, 0, 0, 0, 200)
4076
4077 _UIMenu.Description.Bar = UIResRectangle.New(_UIMenu.Position.X, 123, 431, 4, 0, 0, 0, 255)
4078 _UIMenu.Description.Rectangle = Sprite.New("commonmenu", "gradient_bgd", _UIMenu.Position.X, 127, 431, 30)
4079 _UIMenu.Description.Badge = Sprite.New("shared", "info_icon_32", _UIMenu.Position.X + 5, 130, 31, 31)
4080 _UIMenu.Description.Text = UIResText.New("Description", _UIMenu.Position.X + 35, 125, 0.35)
4081 _UIMenu.Description.Text.LongText = 1
4082
4083 _UIMenu.Background = Sprite.New("commonmenu", "gradient_bgd", _UIMenu.Position.X, 144 + _UIMenu.Position.Y - 37 + _UIMenu.Subtitle.ExtraY, 290, 25)
4084
4085 if _UIMenu.BetterSize == true then
4086 _UIMenu.WidthOffset = math.floor(tonumber(69))
4087 _UIMenu.Logo:Size(431 + _UIMenu.WidthOffset, 107)
4088 _UIMenu.Title:Position(((_UIMenu.WidthOffset + 431) / 2) + _UIMenu.Position.X, 20 + _UIMenu.Position.Y)
4089 if _UIMenu.Subtitle.Rectangle ~= nil then
4090 _UIMenu.Subtitle.Rectangle:Size(431 + _UIMenu.WidthOffset + 100, 37)
4091 _UIMenu.PageCounter.Text:Position(425 + _UIMenu.Position.X + _UIMenu.WidthOffset, 110 + _UIMenu.Position.Y)
4092 end
4093 if _UIMenu.Banner ~= nil then _UIMenu.Banner:Size(431 + _UIMenu.WidthOffset, 107) end
4094 end
4095
4096 Citizen.CreateThread(function()
4097 if not HasScaleformMovieLoaded(_UIMenu.InstructionalScaleform) then
4098 _UIMenu.InstructionalScaleform = RequestScaleformMovie("INSTRUCTIONAL_BUTTONS")
4099 while not HasScaleformMovieLoaded(_UIMenu.InstructionalScaleform) do Citizen.Wait(0) end
4100 end
4101 end)
4102 return setmetatable(_UIMenu, UIMenu)
4103 end
4104
4105 function UIMenu:SetMenuWidthOffset(Offset)
4106 if tonumber(Offset) then
4107 self.WidthOffset = math.floor(tonumber(Offset) + tonumber(70))
4108 self.Logo:Size(431 + self.WidthOffset, 107)
4109 self.Title:Position(((self.WidthOffset + 431) / 2) + self.Position.X, 20 + self.Position.Y)
4110 if self.Subtitle.Rectangle ~= nil then
4111 self.Subtitle.Rectangle:Size(431 + self.WidthOffset + 100, 37)
4112 self.PageCounter.Text:Position(425 + self.Position.X + self.WidthOffset, 110 + self.Position.Y)
4113 end
4114 if self.Banner ~= nil then self.Banner:Size(431 + self.WidthOffset, 107) end
4115 end
4116 end
4117
4118 function UIMenu:DisEnableControls(bool)
4119 if bool then
4120 EnableAllControlActions(2)
4121 else
4122 DisableAllControlActions(2)
4123 end
4124 if bool then
4125 return
4126 else
4127 if Controller() then
4128 for Index = 1, #self.Settings.EnabledControls.Controller do
4129 EnableControlAction(self.Settings.EnabledControls.Controller[Index][1], self.Settings.EnabledControls.Controller[Index][2], true)
4130 end
4131 else
4132 for Index = 1, #self.Settings.EnabledControls.Keyboard do
4133 EnableControlAction(self.Settings.EnabledControls.Keyboard[Index][1], self.Settings.EnabledControls.Keyboard[Index][2], true)
4134 end
4135 end
4136 end
4137 end
4138
4139 function UIMenu:InstructionalButtons(bool) if bool ~= nil then self.Settings.InstrucitonalButtons = ToBool(bool) end end
4140
4141 function UIMenu:SetBannerSprite(Sprite, IncludeChildren)
4142 if Sprite() == "Sprite" then
4143 self.Logo = Sprite
4144 self.Logo:Size(431 + self.WidthOffset, 107)
4145 self.Logo:Position(self.Position.X, self.Position.Y)
4146 self.Banner = nil
4147 if IncludeChildren then
4148 for Item, Menu in pairs(self.Children) do
4149 Menu.Logo = Sprite
4150 Menu.Logo:Size(431 + self.WidthOffset, 107)
4151 Menu.Logo:Position(self.Position.X, self.Position.Y)
4152 Menu.Banner = nil
4153 end
4154 end
4155 end
4156 end
4157
4158 function UIMenu:SetBannerRectangle(Rectangle, IncludeChildren)
4159 if Rectangle() == "Rectangle" then
4160 self.Banner = Rectangle
4161 self.Banner:Size(431 + self.WidthOffset, 107)
4162 self.Banner:Position(self.Position.X, self.Position.Y)
4163 self.Logo = nil
4164 if IncludeChildren then
4165 for Item, Menu in pairs(self.Children) do
4166 Menu.Banner = Rectangle
4167 Menu.Banner:Size(431 + self.WidthOffset, 107)
4168 Menu:Position(self.Position.X, self.Position.Y)
4169 Menu.Logo = nil
4170 end
4171 end
4172 end
4173 end
4174
4175 function UIMenu:CurrentSelection(value)
4176 if tonumber(value) then
4177 if #self.Items == 0 then self.ActiveItem = 0 end
4178 self.Items[self:CurrentSelection()]:Selected(false)
4179 self.ActiveItem = 1000000 - (1000000 % #self.Items) + tonumber(value)
4180 if self:CurrentSelection() > self.Pagination.Max then
4181 self.Pagination.Min = self:CurrentSelection() - self.Pagination.Total
4182 self.Pagination.Max = self:CurrentSelection()
4183 elseif self:CurrentSelection() < self.Pagination.Min then
4184 self.Pagination.Min = self:CurrentSelection()
4185 self.Pagination.Max = self:CurrentSelection() + self.Pagination.Total
4186 end
4187 else
4188 if #self.Items == 0 then
4189 return 1
4190 else
4191 if self.ActiveItem % #self.Items == 0 then
4192 return 1
4193 else
4194 return self.ActiveItem % #self.Items + 1
4195 end
4196 end
4197 end
4198 end
4199
4200 function UIMenu:CalculateWindowHeight()
4201 local Height = 0
4202 for i = 1, #self.Windows do Height = Height + self.Windows[i].Background:Size().Height end
4203 return Height
4204 end
4205
4206 function UIMenu:CalculateItemHeightOffset(Item)
4207 if Item.Base then
4208 return Item.Base.Rectangle.Height
4209 else
4210 return Item.Rectangle.Height
4211 end
4212 end
4213
4214 function UIMenu:CalculateItemHeight()
4215 local ItemOffset = 0 + self.Subtitle.ExtraY - 37
4216 for i = self.Pagination.Min + 1, self.Pagination.Max do
4217 local Item = self.Items[i]
4218 if Item ~= nil then ItemOffset = ItemOffset + self:CalculateItemHeightOffset(Item) end
4219 end
4220
4221 return ItemOffset
4222 end
4223
4224 function UIMenu:RecalculateDescriptionPosition()
4225 local WindowHeight = self:CalculateWindowHeight()
4226 self.Description.Bar:Position(self.Position.X, 149 + self.Position.Y + WindowHeight)
4227 self.Description.Rectangle:Position(self.Position.X, 149 + self.Position.Y + WindowHeight)
4228 self.Description.Badge:Position(self.Position.X + 4, 152 + self.Position.Y + WindowHeight)
4229 self.Description.Text:Position(self.Position.X + 38, 153 + self.Position.Y + WindowHeight)
4230 self.Description.Bar:Size(431 + self.WidthOffset, 4)
4231 self.Description.Rectangle:Size(431 + self.WidthOffset, 30)
4232 self.Description.Bar:Position(self.Position.X, self:CalculateItemHeight() + ((#self.Items > (self.Pagination.Total + 1)) and 37 or 0) + self.Description.Bar:Position().Y)
4233 self.Description.Rectangle:Position(self.Position.X, self:CalculateItemHeight() + ((#self.Items > (self.Pagination.Total + 1)) and 37 or 0) + self.Description.Rectangle:Position().Y)
4234 self.Description.Badge:Position(self.Position.X + 4, self:CalculateItemHeight() + ((#self.Items > (self.Pagination.Total + 1)) and 37 or 0) + self.Description.Badge:Position().Y)
4235 self.Description.Text:Position(self.Position.X + 38, self:CalculateItemHeight() + ((#self.Items > (self.Pagination.Total + 1)) and 37 or 0) + self.Description.Text:Position().Y)
4236 end
4237
4238 function UIMenu:CaclulatePanelPosition(HasDescription)
4239 local Height = self:CalculateWindowHeight() + 149 + self.Position.Y
4240 if HasDescription then Height = Height + self.Description.Rectangle:Size().Height + 5 end
4241 return self:CalculateItemHeight() + ((#self.Items > (self.Pagination.Total + 1)) and 37 or 0) + Height
4242 end
4243
4244 function UIMenu:AddWindow(Window)
4245 if Window() == "UIMenuWindow" then
4246 Window:SetParentMenu(self)
4247 Window:Offset(self.Position.X, self.Position.Y)
4248 table.insert(self.Windows, Window)
4249 self.ReDraw = true
4250 self:RecalculateDescriptionPosition()
4251 end
4252 end
4253
4254 function UIMenu:RemoveWindowAt(Index)
4255 if tonumber(Index) then
4256 if self.Windows[Index] then
4257 table.remove(self.Windows, Index)
4258 self.ReDraw = true
4259 self:RecalculateDescriptionPosition()
4260 end
4261 end
4262 end
4263
4264 function UIMenu:AddItem(Item)
4265 Items = Item
4266 if #Items == 0 then
4267 if Item() == "UIMenuItem" then
4268 local SelectedItem = self:CurrentSelection()
4269 Item:SetParentMenu(self)
4270 Item:Offset(self.Position.X, self.Position.Y)
4271 Item:Position((#self.Items * 25) - 37 + self.Subtitle.ExtraY)
4272 table.insert(self.Items, Item)
4273 self:RecalculateDescriptionPosition()
4274 self:CurrentSelection(SelectedItem)
4275 end
4276 end
4277 for i = 1, #Items, 1 do
4278 Item = Items[i]
4279 if Item() == "UIMenuItem" then
4280 local SelectedItem = self:CurrentSelection()
4281 Item:SetParentMenu(self)
4282 Item:Offset(self.Position.X, self.Position.Y)
4283 Item:Position((#self.Items * 25) - 37 + self.Subtitle.ExtraY)
4284 table.insert(self.Items, Item)
4285 self:RecalculateDescriptionPosition()
4286 self:CurrentSelection(SelectedItem)
4287 end
4288 end
4289 end
4290
4291 function UIMenu:AddSpacerItem(Title, Description)
4292 local output = "~h~";
4293 local length = Title:len();
4294 local totalSize = 50 - length;
4295
4296 for i=0, totalSize do
4297 output = output.." ";
4298 end
4299 output = output..Title;
4300 local spacerItem = nil;
4301 if string.IsNullOrEmpty(Description) then spacerItem = UIMenuItem.New(output, "")
4302 else spacerItem = UIMenuItem.New(output, Description) end
4303 spacerItem:Enabled(false)
4304 self:AddItem(spacerItem)
4305 end
4306
4307 function UIMenu:GetItemAt(index) return self.Items[index] end
4308
4309 function UIMenu:RemoveItemAt(Index)
4310 if tonumber(Index) then
4311 if self.Items[Index] then
4312 local SelectedItem = self:CurrentSelection()
4313 if #self.Items > self.Pagination.Total and self.Pagination.Max == #self.Items - 1 then
4314 self.Pagination.Min = self.Pagination.Min - 1
4315 self.Pagination.Max = self.Pagination.Max + 1
4316 end
4317 table.remove(self.Items, tonumber(Index))
4318 self:RecalculateDescriptionPosition()
4319 self:CurrentSelection(SelectedItem)
4320 end
4321 end
4322 end
4323
4324 function UIMenu:RefreshIndex()
4325 if #self.Items == 0 then
4326 self.ActiveItem = 1000
4327 self.Pagination.Max = self.Pagination.Total + 1
4328 self.Pagination.Min = 0
4329 return
4330 end
4331 self.Items[self:CurrentSelection()]:Selected(false)
4332 self.ActiveItem = 1000 - (1000 % #self.Items)
4333 self.Pagination.Max = self.Pagination.Total + 1
4334 self.Pagination.Min = 0
4335 self.ReDraw = true
4336 end
4337
4338 function UIMenu:Clear()
4339 self.Items = {}
4340 self.ReDraw = true
4341 self:RecalculateDescriptionPosition()
4342 end
4343
4344 function UIMenu:MultilineFormat(str, offset)
4345 if offset == nil then offset = 0 end
4346 if tostring(str) then
4347 local PixelPerLine = 425 + self.WidthOffset - offset
4348 local AggregatePixels = 0
4349 local output = ""
4350 local words = string.split(tostring(str), " ")
4351 for i = 1, #words do
4352 local offset = MeasureStringWidth(words[i], 0, 0.30)
4353 AggregatePixels = AggregatePixels + offset
4354 if AggregatePixels > PixelPerLine then
4355 output = output .. "\n" .. words[i] .. " "
4356 AggregatePixels = offset + MeasureString(" ")
4357 else
4358 output = output .. words[i] .. " "
4359 AggregatePixels = AggregatePixels + MeasureString(" ")
4360 end
4361 end
4362
4363 return output
4364 end
4365 end
4366
4367 function UIMenu:DrawCalculations()
4368 local WindowHeight = self:CalculateWindowHeight()
4369 if self.Settings.MultilineFormats then
4370 if self.Subtitle.Rectangle and not self.Subtitle.Formatted then
4371 self.Subtitle.Formatted = true
4372 self.Subtitle.Text:Text(self:MultilineFormat(self.Subtitle.Text:Text()))
4373 local Linecount = #string.split(self.Subtitle.Text:Text(), "\n")
4374 self.Subtitle.ExtraY = ((Linecount == 1) and 37 or ((Linecount + 1) * 22))
4375 self.Subtitle.Rectangle:Size(431 + self.WidthOffset, self.Subtitle.ExtraY)
4376 end
4377 elseif self.Subtitle.Formatted then
4378 self.Subtitle.Formatted = false
4379 self.Subtitle.ExtraY = 37
4380 self.Subtitle.Rectangle:Size(431 + self.WidthOffset, self.Subtitle.ExtraY)
4381 self.Subtitle.Text:Text(self.Subtitle.BackupText)
4382 end
4383
4384 self.Background:Size(431 + self.WidthOffset, self:CalculateItemHeight() + WindowHeight + ((self.Subtitle.ExtraY > 0) and 0 or 37))
4385
4386 self.Extra.Up:Size(431 + self.WidthOffset, 18)
4387 self.Extra.Down:Size(431 + self.WidthOffset, 18)
4388
4389 local offsetExtra = 4
4390 self.Extra.Up:Position(self.Position.X, 144 + self:CalculateItemHeight() + self.Position.Y + WindowHeight + offsetExtra)
4391 self.Extra.Down:Position(self.Position.X, 144 + 18 + self:CalculateItemHeight() + self.Position.Y + WindowHeight + offsetExtra)
4392
4393 if self.WidthOffset > 0 then
4394 self.ArrowSprite:Position(190 + self.Position.X + (self.WidthOffset / 2),
4395 141 + self:CalculateItemHeight() + self.Position.Y + WindowHeight + offsetExtra)
4396 else
4397 self.ArrowSprite:Position(190 + self.Position.X + self.WidthOffset,
4398 141 + self:CalculateItemHeight() + self.Position.Y + WindowHeight + offsetExtra)
4399 end
4400
4401 self.ReDraw = false
4402
4403 if #self.Items ~= 0 and self.Items[self:CurrentSelection()]:Description() ~= "" then
4404 self:RecalculateDescriptionPosition()
4405 local description = self.Items[self:CurrentSelection()]:Description()
4406 if self.Settings.MultilineFormats then
4407 self.Description.Text:Text(self:MultilineFormat(description, 35))
4408 else
4409 self.Description.Text:Text(description)
4410 end
4411 local Linecount = #string.split(self.Description.Text:Text(), "\n")
4412 self.Description.Rectangle:Size(431 + self.WidthOffset, ((Linecount == 1) and 37 or ((Linecount + 1) * 22)))
4413 end
4414 end
4415
4416 function UIMenu:Visible(bool)
4417 if bool ~= nil then
4418 self._Visible = ToBool(bool)
4419 self.JustOpened = ToBool(bool)
4420 self.Dirty = ToBool(bool)
4421 self:UpdateScaleform()
4422 if self.ParentMenu ~= nil or ToBool(bool) == false then return end
4423 if self.Settings.ResetCursorOnOpen then
4424 if SetCursorSprite ~= nil then
4425 SetCursorSprite(1)
4426 else
4427 N_0x8db8cffd58b62552(1)
4428 end
4429 if SetCursorLocation ~= nil then
4430 SetCursorLocation(0.5, 0.5)
4431 else
4432 N_0xfc695459d4d0e219(0.5, 0.5)
4433 end
4434 end
4435 else
4436 return self._Visible
4437 end
4438 end
4439
4440 function UIMenu:ProcessControl()
4441 if not self._Visible then return end
4442 if self.JustOpened then
4443 self.JustOpened = false
4444 return
4445 end
4446 if self.Controls.Back.Enabled and
4447 (IsDisabledControlJustReleased(0, 177) or IsDisabledControlJustReleased(1, 177) or IsDisabledControlJustReleased(2, 177) or
4448 IsDisabledControlJustReleased(0, 199) or IsDisabledControlJustReleased(1, 199) or IsDisabledControlJustReleased(2, 199)) then
4449 self:GoBack()
4450 end
4451 if #self.Items == 0 then return end
4452 if not self.UpPressed then
4453 if self.Controls.Up.Enabled and
4454 (IsDisabledControlJustPressed(0, 172) or IsDisabledControlJustPressed(1, 172) or IsDisabledControlJustPressed(2, 172) or
4455 IsDisabledControlJustPressed(0, 241) or IsDisabledControlJustPressed(1, 241) or IsDisabledControlJustPressed(2, 241) or
4456 IsDisabledControlJustPressed(2, 241)) then
4457 Citizen.CreateThread(function()
4458 self.UpPressed = true
4459 if #self.Items > self.Pagination.Total + 1 then
4460 self:GoUpOverflow()
4461 else
4462 self:GoUp()
4463 end
4464 self:UpdateScaleform()
4465 Citizen.Wait(175)
4466 while self.Controls.Up.Enabled and
4467 (IsDisabledControlPressed(0, 172) or IsDisabledControlPressed(1, 172) or IsDisabledControlPressed(2, 172) or
4468 IsDisabledControlPressed(0, 241) or IsDisabledControlPressed(1, 241) or IsDisabledControlPressed(2, 241) or
4469 IsDisabledControlPressed(2, 241)) do
4470 if #self.Items > self.Pagination.Total + 1 then
4471 self:GoUpOverflow()
4472 else
4473 self:GoUp()
4474 end
4475 self:UpdateScaleform()
4476 Citizen.Wait(125)
4477 end
4478 self.UpPressed = false
4479 end)
4480 end
4481 end
4482 if not self.DownPressed then
4483 if self.Controls.Down.Enabled and
4484 (IsDisabledControlJustPressed(0, 173) or IsDisabledControlJustPressed(1, 173) or IsDisabledControlJustPressed(2, 173) or
4485 IsDisabledControlJustPressed(0, 242) or IsDisabledControlJustPressed(1, 242) or IsDisabledControlJustPressed(2, 242)) then
4486 Citizen.CreateThread(function()
4487 self.DownPressed = true
4488 if #self.Items > self.Pagination.Total + 1 then
4489 self:GoDownOverflow()
4490 else
4491 self:GoDown()
4492 end
4493 self:UpdateScaleform()
4494 Citizen.Wait(175)
4495 while self.Controls.Down.Enabled and
4496 (IsDisabledControlPressed(0, 173) or IsDisabledControlPressed(1, 173) or IsDisabledControlPressed(2, 173) or
4497 IsDisabledControlPressed(0, 242) or IsDisabledControlPressed(1, 242) or IsDisabledControlPressed(2, 242)) do
4498 if #self.Items > self.Pagination.Total + 1 then
4499 self:GoDownOverflow()
4500 else
4501 self:GoDown()
4502 end
4503 self:UpdateScaleform()
4504 Citizen.Wait(125)
4505 end
4506 self.DownPressed = false
4507 end)
4508 end
4509 end
4510 if not self.LeftPressed then
4511 if self.Controls.Left.Enabled and
4512 (IsDisabledControlJustPressed(0, 174) or IsDisabledControlJustPressed(1, 174) or IsDisabledControlJustPressed(2, 174)) then
4513 local type, subtype = self.Items[self:CurrentSelection()]()
4514 Citizen.CreateThread(function()
4515 if (subtype == "UIMenuSliderHeritageItem") then
4516 self.LeftPressed = true
4517 self:GoLeft()
4518 Citizen.Wait(40)
4519 while self.Controls.Left.Enabled and
4520 (IsDisabledControlPressed(0, 174) or IsDisabledControlPressed(1, 174) or IsDisabledControlPressed(2, 174)) do
4521 self:GoLeft()
4522 Citizen.Wait(20)
4523 end
4524 self.LeftPressed = false
4525 else
4526 self.LeftPressed = true
4527 self:GoLeft()
4528 Citizen.Wait(175)
4529 while self.Controls.Left.Enabled and
4530 (IsDisabledControlPressed(0, 174) or IsDisabledControlPressed(1, 174) or IsDisabledControlPressed(2, 174)) do
4531 self:GoLeft()
4532 Citizen.Wait(125)
4533 end
4534 self.LeftPressed = false
4535 end
4536 end)
4537 end
4538 end
4539 if not self.RightPressed then
4540 if self.Controls.Right.Enabled and
4541 (IsDisabledControlJustPressed(0, 175) or IsDisabledControlJustPressed(1, 175) or IsDisabledControlJustPressed(2, 175)) then
4542 Citizen.CreateThread(function()
4543 local type, subtype = self.Items[self:CurrentSelection()]()
4544 if (subtype == "UIMenuSliderHeritageItem") then
4545 self.RightPressed = true
4546 self:GoRight()
4547 Citizen.Wait(40)
4548 while self.Controls.Right.Enabled and
4549 (IsDisabledControlPressed(0, 175) or IsDisabledControlPressed(1, 175) or IsDisabledControlPressed(2, 175)) do
4550 self:GoRight()
4551 Citizen.Wait(20)
4552 end
4553 self.RightPressed = false
4554 else
4555 self.RightPressed = true
4556 self:GoRight()
4557 Citizen.Wait(175)
4558 while self.Controls.Right.Enabled and
4559 (IsDisabledControlPressed(0, 175) or IsDisabledControlPressed(1, 175) or IsDisabledControlPressed(2, 175)) do
4560 self:GoRight()
4561 Citizen.Wait(125)
4562 end
4563 self.RightPressed = false
4564 end
4565 end)
4566 end
4567 end
4568 if self.Controls.Select.Enabled and
4569 (IsDisabledControlJustPressed(0, 201) or IsDisabledControlJustPressed(1, 201) or IsDisabledControlJustPressed(2, 201)) then
4570 self:SelectItem()
4571 end
4572 end
4573
4574 function UIMenu:GoUpOverflow()
4575 if #self.Items <= self.Pagination.Total + 1 then return end
4576 if self:CurrentSelection() <= self.Pagination.Min + 1 then
4577 if self:CurrentSelection() == 1 then
4578 self.Pagination.Min = #self.Items - (self.Pagination.Total + 1)
4579 self.Pagination.Max = #self.Items
4580 self.Items[self:CurrentSelection()]:Selected(false)
4581 self.ActiveItem = 1000 - (1000 % #self.Items)
4582 self.ActiveItem = self.ActiveItem + (#self.Items - 1)
4583 self.Items[self:CurrentSelection()]:Selected(true)
4584 else
4585 self.Pagination.Min = self.Pagination.Min - 1
4586 self.Pagination.Max = self.Pagination.Max - 1
4587 self.Items[self:CurrentSelection()]:Selected(false)
4588 self.ActiveItem = self.ActiveItem - 1
4589 self.Items[self:CurrentSelection()]:Selected(true)
4590 end
4591 else
4592 self.Items[self:CurrentSelection()]:Selected(false)
4593 self.ActiveItem = self.ActiveItem - 1
4594 self.Items[self:CurrentSelection()]:Selected(true)
4595 end
4596 PlaySoundFrontend(-1, self.Settings.Audio.UpDown, self.Settings.Audio.Library, true)
4597 self.OnIndexChange(self, self:CurrentSelection())
4598 self.ReDraw = true
4599 end
4600
4601 function UIMenu:GoUp()
4602 if #self.Items > self.Pagination.Total + 1 then return end
4603 self.Items[self:CurrentSelection()]:Selected(false)
4604 self.ActiveItem = self.ActiveItem - 1
4605 self.Items[self:CurrentSelection()]:Selected(true)
4606 PlaySoundFrontend(-1, self.Settings.Audio.UpDown, self.Settings.Audio.Library, true)
4607 self.OnIndexChange(self, self:CurrentSelection())
4608 self.ReDraw = true
4609 end
4610
4611 function UIMenu:GoDownOverflow()
4612 if #self.Items <= self.Pagination.Total + 1 then return end
4613
4614 if self:CurrentSelection() >= self.Pagination.Max then
4615 if self:CurrentSelection() == #self.Items then
4616 self.Pagination.Min = 0
4617 self.Pagination.Max = self.Pagination.Total + 1
4618 self.Items[self:CurrentSelection()]:Selected(false)
4619 self.ActiveItem = 1000 - (1000 % #self.Items)
4620 self.Items[self:CurrentSelection()]:Selected(true)
4621 else
4622 self.Pagination.Max = self.Pagination.Max + 1
4623 self.Pagination.Min = self.Pagination.Max - (self.Pagination.Total + 1)
4624 self.Items[self:CurrentSelection()]:Selected(false)
4625 self.ActiveItem = self.ActiveItem + 1
4626 self.Items[self:CurrentSelection()]:Selected(true)
4627 end
4628 else
4629 self.Items[self:CurrentSelection()]:Selected(false)
4630 self.ActiveItem = self.ActiveItem + 1
4631 self.Items[self:CurrentSelection()]:Selected(true)
4632 end
4633 PlaySoundFrontend(-1, self.Settings.Audio.UpDown, self.Settings.Audio.Library, true)
4634 self.OnIndexChange(self, self:CurrentSelection())
4635 self.ReDraw = true
4636 end
4637
4638 function UIMenu:GoDown()
4639 if #self.Items > self.Pagination.Total + 1 then return end
4640
4641 self.Items[self:CurrentSelection()]:Selected(false)
4642 self.ActiveItem = self.ActiveItem + 1
4643 self.Items[self:CurrentSelection()]:Selected(true)
4644 PlaySoundFrontend(-1, self.Settings.Audio.UpDown, self.Settings.Audio.Library, true)
4645 self.OnIndexChange(self, self:CurrentSelection())
4646 self.ReDraw = true
4647 end
4648
4649 function UIMenu:GoLeft()
4650 local type, subtype = self.Items[self:CurrentSelection()]()
4651 if subtype ~= "UIMenuListItem" and subtype ~= "UIMenuSliderItem" and subtype ~= "UIMenuProgressItem" and subtype ~=
4652 "UIMenuSliderHeritageItem" and subtype ~= "UIMenuSliderProgressItem" then return end
4653
4654 if not self.Items[self:CurrentSelection()]:Enabled() then
4655 PlaySoundFrontend(-1, self.Settings.Audio.Error, self.Settings.Audio.Library, true)
4656 return
4657 end
4658
4659 if subtype == "UIMenuListItem" then
4660 local Item = self.Items[self:CurrentSelection()]
4661 Item:Index(Item._Index - 1)
4662 self.OnListChange(self, Item, Item._Index)
4663 Item.OnListChanged(self, Item, Item._Index)
4664 PlaySoundFrontend(-1, self.Settings.Audio.LeftRight, self.Settings.Audio.Library, true)
4665 elseif subtype == "UIMenuSliderItem" then
4666 local Item = self.Items[self:CurrentSelection()]
4667 Item:Index(Item._Index - 1)
4668 self.OnSliderChange(self, Item, Item:Index())
4669 Item.OnSliderChanged(self, Item, Item._Index)
4670 PlaySoundFrontend(-1, self.Settings.Audio.LeftRight, self.Settings.Audio.Library, true)
4671 elseif subtype == "UIMenuSliderProgressItem" then
4672 local Item = self.Items[self:CurrentSelection()]
4673 Item:Index(Item._Index - 1)
4674 self.OnSliderChange(self, Item, Item:Index())
4675 Item.OnSliderChanged(self, Item, Item._Index)
4676 PlaySoundFrontend(-1, self.Settings.Audio.LeftRight, self.Settings.Audio.Library, true)
4677 elseif subtype == "UIMenuProgressItem" then
4678 local Item = self.Items[self:CurrentSelection()]
4679 Item:Index(Item.Data.Index - 1)
4680 self.OnProgressChange(self, Item, Item.Data.Index)
4681 Item.OnProgressChanged(self, Item, Item.Data.Index)
4682 PlaySoundFrontend(-1, self.Settings.Audio.LeftRight, self.Settings.Audio.Library, true)
4683 elseif subtype == "UIMenuSliderHeritageItem" then
4684 local Item = self.Items[self:CurrentSelection()]
4685 Item:Index(Item._Index - 0.1)
4686 self.OnSliderChange(self, Item, Item:Index())
4687 Item.OnSliderChanged(self, Item, Item._Index)
4688 if not Item.Pressed then
4689 Item.Pressed = true
4690 Citizen.CreateThread(function()
4691 Item.Audio.Id = GetSoundId()
4692 PlaySoundFrontend(Item.Audio.Id, Item.Audio.Slider, Item.Audio.Library, 1)
4693 Citizen.Wait(100)
4694 StopSound(Item.Audio.Id)
4695 ReleaseSoundId(Item.Audio.Id)
4696 Item.Pressed = false
4697 end)
4698 end
4699
4700 end
4701 end
4702
4703 function UIMenu:GoRight()
4704 local type, subtype = self.Items[self:CurrentSelection()]()
4705 if subtype ~= "UIMenuListItem" and subtype ~= "UIMenuSliderItem" and subtype ~= "UIMenuProgressItem" and subtype ~=
4706 "UIMenuSliderHeritageItem" and subtype ~= "UIMenuSliderProgressItem" then return end
4707 if not self.Items[self:CurrentSelection()]:Enabled() then
4708 PlaySoundFrontend(-1, self.Settings.Audio.Error, self.Settings.Audio.Library, true)
4709 return
4710 end
4711 if subtype == "UIMenuListItem" then
4712 local Item = self.Items[self:CurrentSelection()]
4713 Item:Index(Item._Index + 1)
4714 self.OnListChange(self, Item, Item._Index)
4715 Item.OnListChanged(self, Item, Item._Index)
4716 PlaySoundFrontend(-1, self.Settings.Audio.LeftRight, self.Settings.Audio.Library, true)
4717 elseif subtype == "UIMenuSliderItem" then
4718 local Item = self.Items[self:CurrentSelection()]
4719 Item:Index(Item._Index + 1)
4720 self.OnSliderChange(self, Item, Item:Index())
4721 Item.OnSliderChanged(self, Item, Item._Index)
4722 PlaySoundFrontend(-1, self.Settings.Audio.LeftRight, self.Settings.Audio.Library, true)
4723 elseif subtype == "UIMenuSliderProgressItem" then
4724 local Item = self.Items[self:CurrentSelection()]
4725 Item:Index(Item._Index + 1)
4726 self.OnSliderChange(self, Item, Item:Index())
4727 Item.OnSliderChanged(self, Item, Item._Index)
4728 PlaySoundFrontend(-1, self.Settings.Audio.LeftRight, self.Settings.Audio.Library, true)
4729 elseif subtype == "UIMenuProgressItem" then
4730 local Item = self.Items[self:CurrentSelection()]
4731 Item:Index(Item.Data.Index + 1)
4732 self.OnProgressChange(self, Item, Item.Data.Index)
4733 Item.OnProgressChanged(self, Item, Item.Data.Index)
4734 PlaySoundFrontend(-1, self.Settings.Audio.LeftRight, self.Settings.Audio.Library, true)
4735 elseif subtype == "UIMenuSliderHeritageItem" then
4736 local Item = self.Items[self:CurrentSelection()]
4737 Item:Index(Item._Index + 0.1)
4738 self.OnSliderChange(self, Item, Item:Index())
4739 Item.OnSliderChanged(self, Item, Item._Index)
4740 if not Item.Pressed then
4741 Item.Pressed = true
4742 Citizen.CreateThread(function()
4743 Item.Audio.Id = GetSoundId()
4744 PlaySoundFrontend(Item.Audio.Id, Item.Audio.Slider, Item.Audio.Library, 1)
4745 Citizen.Wait(100)
4746 StopSound(Item.Audio.Id)
4747 ReleaseSoundId(Item.Audio.Id)
4748 Item.Pressed = false
4749 end)
4750 end
4751 end
4752 end
4753
4754 function UIMenu:SelectItem()
4755 if not self.Items[self:CurrentSelection()]:Enabled() then
4756 PlaySoundFrontend(-1, self.Settings.Audio.Error, self.Settings.Audio.Library, true)
4757 return
4758 end
4759 local Item = self.Items[self:CurrentSelection()]
4760 local type, subtype = Item()
4761 if subtype == "UIMenuCheckboxItem" then
4762 Item.Checked = not Item.Checked
4763 PlaySoundFrontend(-1, self.Settings.Audio.Select, self.Settings.Audio.Library, true)
4764 self.OnCheckboxChange(self, Item, Item.Checked)
4765 Item.CheckboxEvent(self, Item, Item.Checked)
4766 elseif subtype == "UIMenuListItem" then
4767 PlaySoundFrontend(-1, self.Settings.Audio.Select, self.Settings.Audio.Library, true)
4768 self.OnListSelect(self, Item, Item._Index)
4769 Item.OnListSelected(self, Item, Item._Index)
4770 elseif subtype == "UIMenuSliderItem" then
4771 PlaySoundFrontend(-1, self.Settings.Audio.Select, self.Settings.Audio.Library, true)
4772 self.OnSliderSelect(self, Item, Item._Index)
4773 Item.OnSliderSelected(Item._Index)
4774 elseif subtype == "UIMenuSliderProgressItem" then
4775 PlaySoundFrontend(-1, self.Settings.Audio.Select, self.Settings.Audio.Library, true)
4776 self.OnSliderSelect(self, Item, Item._Index)
4777 Item.OnSliderSelected(Item._Index)
4778 elseif subtype == "UIMenuProgressItem" then
4779 PlaySoundFrontend(-1, self.Settings.Audio.Select, self.Settings.Audio.Library, true)
4780 self.OnProgressSelect(self, Item, Item.Data.Index)
4781 Item.OnProgressSelected(Item.Data.Index)
4782 elseif subtype == "UIMenuSliderHeritageItem" then
4783 PlaySoundFrontend(-1, self.Settings.Audio.Select, self.Settings.Audio.Library, true)
4784 self.OnSliderSelect(self, Item, Item._Index)
4785 Item.OnSliderSelected(Item._Index)
4786 else
4787 PlaySoundFrontend(-1, self.Settings.Audio.Select, self.Settings.Audio.Library, true)
4788 self.OnItemSelect(self, Item, self:CurrentSelection())
4789 Item.Activated(self, Item)
4790 if not self.Children[Item] then return end
4791 self:Visible(false)
4792 self.Children[Item]:Visible(true)
4793 self.OnMenuChanged(self, self.Children[self.Items[self:CurrentSelection()]], true)
4794 end
4795 end
4796
4797 function UIMenu:GoBack()
4798 PlaySoundFrontend(-1, self.Settings.Audio.Back, self.Settings.Audio.Library, true)
4799 self:Visible(false)
4800 if self.ParentMenu ~= nil then
4801 self.ParentMenu:Visible(true)
4802 self.OnMenuChanged(self, self.ParentMenu, false)
4803 if self.Settings.ResetCursorOnOpen then
4804 if SetCursorLocation ~= nil then
4805 SetCursorLocation(0.5, 0.5)
4806 else
4807 N_0xfc695459d4d0e219(0.5, 0.5)
4808 end
4809 end
4810 end
4811 self.OnMenuClosed(self)
4812 end
4813
4814 function UIMenu:BindMenuToItem(Menu, Item)
4815 if Menu() == "UIMenu" and Item() == "UIMenuItem" then
4816 Menu.ParentMenu = self
4817 Menu.ParentItem = Item
4818 self.Children[Item] = Menu
4819 end
4820 end
4821
4822 function UIMenu:ReleaseMenuFromItem(Item)
4823 if Item() == "UIMenuItem" then
4824 if not self.Children[Item] then return false end
4825 self.Children[Item].ParentMenu = nil
4826 self.Children[Item].ParentItem = nil
4827 self.Children[Item] = nil
4828 return true
4829 end
4830 end
4831
4832 function UIMenu:PageCounterName(String)
4833 self.PageCounter.isCustom = true
4834 self.PageCounter.PreText = String
4835 self.PageCounter.Text:Text(self.PageCounter.PreText)
4836 self.PageCounter.Text:Draw()
4837 end
4838
4839 function UIMenu:Draw()
4840 if not self._Visible then return end
4841 HideHudComponentThisFrame(19)
4842 if self.Settings.ControlDisablingEnabled then self:DisEnableControls(false) end
4843 if self.Settings.InstructionalButtons then DrawScaleformMovieFullscreen(self.InstructionalScaleform, 255, 255, 255, 255, 0) end
4844 if self.Settings.ScaleWithSafezone then
4845 if N_0xB8A850F20A067EB6 ~= nil then
4846 N_0xB8A850F20A067EB6(76, 84)
4847 elseif SetScriptGfxAlign ~= nil then
4848 SetScriptGfxAlign(76, 84)
4849 elseif SetScreenDrawPosition ~= nil then
4850 SetScreenDrawPosition(76, 84)
4851 end
4852
4853 if N_0xF5A2C681787E579D ~= nil then
4854 N_0xF5A2C681787E579D(0, 0, 0, 0)
4855 elseif ScreenDrawPositionRatio ~= nil then
4856 ScreenDrawPositionRatio(0, 0, 0, 0)
4857 elseif SetScriptGfxAlignParams ~= nil then
4858 SetScriptGfxAlignParams(0, 0, 0, 0)
4859 end
4860
4861 if self.Settings.DrawOrder ~= nil then SetScriptGfxDrawOrder(tonumber(self.Settings.DrawOrder)) end
4862 if GetScriptGfxPosition ~= nil then
4863 self.DrawOffset.X, self.DrawOffset.Y = GetScriptGfxPosition(0, 0)
4864 else
4865 self.DrawOffset.X, self.DrawOffset.Y = N_0x6dd8f5aa635eb4b2(0, 0)
4866 end
4867 end
4868 if self.ReDraw then self:DrawCalculations() end
4869 if self.Logo then
4870 self.Logo:Draw()
4871 elseif self.Banner then
4872 self.Banner:Draw()
4873 end
4874 self.Title:Draw()
4875 if self.Subtitle.Rectangle then
4876 self.Subtitle.Rectangle:Draw()
4877 self.Subtitle.Text:Draw()
4878 end
4879 if #self.Items ~= 0 or #self.Windows ~= 0 then self.Background:Draw() end
4880 if #self.Windows ~= 0 then
4881 local WindowOffset = 0
4882 for index = 1, #self.Windows do
4883 if self.Windows[index - 1] then
4884 WindowOffset = WindowOffset + self.Windows[index - 1].Background:Size().Height
4885 end
4886 local Window = self.Windows[index]
4887 Window:Position(WindowOffset + self.Subtitle.ExtraY - 37)
4888 Window:Draw()
4889 end
4890 end
4891 if #self.Items == 0 then
4892 if self.Settings.ScaleWithSafezone then
4893 if ResetScriptGfxAlign ~= nil then
4894 ResetScriptGfxAlign()
4895 elseif ScreenDrawPositionEnd ~= nil then
4896 ScreenDrawPositionEnd()
4897 else
4898 N_0xe3a3db414a373dab()
4899 end
4900 end
4901 return
4902 end
4903
4904 local CurrentSelection = self:CurrentSelection()
4905 self.Items[CurrentSelection]:Selected(true)
4906
4907 if self.Items[CurrentSelection]:Description() ~= "" then
4908 self.Description.Bar:Draw()
4909 self.Description.Rectangle:Draw()
4910 self.Description.Badge:Draw()
4911 self.Description.Text:Draw()
4912 end
4913
4914 if self.Items[CurrentSelection].Panels ~= nil then
4915 if #self.Items[CurrentSelection].Panels ~= 0 then
4916 local PanelOffset = self:CaclulatePanelPosition(self.Items[CurrentSelection]:Description() ~= "")
4917 for index = 1, #self.Items[CurrentSelection].Panels do
4918 if self.Items[CurrentSelection].Panels[index - 1] then
4919 PanelOffset = PanelOffset + self.Items[CurrentSelection].Panels[index - 1].Background:Size().Height + 5
4920 end
4921 self.Items[CurrentSelection].Panels[index]:Position(PanelOffset)
4922 self.Items[CurrentSelection].Panels[index]:Draw()
4923 end
4924 end
4925 end
4926
4927 local WindowHeight = self:CalculateWindowHeight()
4928
4929 if #self.Items <= self.Pagination.Total + 1 then
4930 local ItemOffset = self.Subtitle.ExtraY - 37 + WindowHeight
4931 for index = 1, #self.Items do
4932 local Item = self.Items[index]
4933 Item:Position(ItemOffset)
4934 Item:Draw()
4935 ItemOffset = ItemOffset + self:CalculateItemHeightOffset(Item)
4936 end
4937 else
4938 local ItemOffset = self.Subtitle.ExtraY - 37 + WindowHeight
4939 for index = self.Pagination.Min + 1, self.Pagination.Max, 1 do
4940 if self.Items[index] then
4941 local Item = self.Items[index]
4942 Item:Position(ItemOffset)
4943 Item:Draw()
4944 ItemOffset = ItemOffset + self:CalculateItemHeightOffset(Item)
4945 end
4946 end
4947
4948 self.Extra.Up:Draw()
4949 self.Extra.Down:Draw()
4950 self.ArrowSprite:Draw()
4951
4952 if self.PageCounter.isCustom ~= true then
4953 if self.PageCounter.Text ~= nil then
4954 local Caption = self.PageCounter.PreText .. CurrentSelection .. " / " .. #self.Items
4955 self.PageCounter.Text:Text(Caption)
4956 self.PageCounter.Text:Draw()
4957 end
4958 end
4959 end
4960
4961 if self.PageCounter.isCustom ~= false then
4962 if self.PageCounter.Text ~= nil then
4963 self.PageCounter.Text:Text(self.PageCounter.PreText)
4964 self.PageCounter.Text:Draw()
4965 end
4966 end
4967
4968 if self.Settings.ScaleWithSafezone then
4969 if ResetScriptGfxAlign ~= nil then
4970 ResetScriptGfxAlign()
4971 elseif ScreenDrawPositionEnd ~= nil then
4972 ScreenDrawPositionEnd()
4973 else
4974 N_0xe3a3db414a373dab()
4975 end
4976 end
4977 end
4978
4979 function UIMenu:ProcessMouse()
4980 if not self._Visible or self.JustOpened or #self.Items == 0 or ToBool(Controller()) or not self.Settings.MouseControlsEnabled then
4981 EnableControlAction(0, 2, true)
4982 EnableControlAction(0, 1, true)
4983 EnableControlAction(0, 25, true)
4984 EnableControlAction(0, 24, true)
4985 if self.Dirty then for _, Item in pairs(self.Items) do if Item:Hovered() then Item:Hovered(false) end end end
4986 return
4987 end
4988
4989 local WindowHeight = self:CalculateWindowHeight()
4990 local Limit = #self.Items
4991 local ItemOffset = 0
4992
4993 ShowCursorThisFrame()
4994
4995 if #self.Items > self.Pagination.Total + 1 then Limit = self.Pagination.Max end
4996
4997 local W, H = GetResolution()
4998
4999 if IsMouseInBounds(0, 0, 30, H) and self.Settings.MouseEdgeEnabled then
5000 SetGameplayCamRelativeHeading(GetGameplayCamRelativeHeading() + 5)
5001 if SetCursorSprite ~= nil then
5002 SetCursorSprite(6)
5003 else
5004 N_0x8db8cffd58b62552(6)
5005 end
5006 elseif IsMouseInBounds(W - 30, 0, 30, H) and self.Settings.MouseEdgeEnabled then
5007 SetGameplayCamRelativeHeading(GetGameplayCamRelativeHeading() - 5)
5008 if SetCursorSprite ~= nil then
5009 SetCursorSprite(7)
5010 else
5011 N_0x8db8cffd58b62552(7)
5012 end
5013 elseif self.Settings.MouseEdgeEnabled then
5014 if SetCursorSprite ~= nil then
5015 SetCursorSprite(1)
5016 else
5017 N_0x8db8cffd58b62552(1)
5018 end
5019 end
5020
5021 for i = self.Pagination.Min + 1, Limit, 1 do
5022 local X, Y = self.Position.X, self.Position.Y + 144 - 37 + self.Subtitle.ExtraY + ItemOffset + WindowHeight
5023 local Item = self.Items[i]
5024 local Type, SubType = Item()
5025 local Width, Height = 431 + self.WidthOffset, self:CalculateItemHeightOffset(Item)
5026
5027 if IsMouseInBounds(X, Y, Width, Height, self.DrawOffset) then
5028 Item:Hovered(true)
5029 if not self.Controls.MousePressed then
5030 if IsDisabledControlJustPressed(0, 24) then
5031 Citizen.CreateThread(function()
5032 local _X, _Y, _Width, _Height = X, Y, Width, Height
5033 self.Controls.MousePressed = true
5034 if Item:Selected() and Item:Enabled() then
5035 if SubType == "UIMenuListItem" then
5036 if IsMouseInBounds(Item.LeftArrow.X, Item.LeftArrow.Y, Item.LeftArrow.Width, Item.LeftArrow.Height,
5037 self.DrawOffset) then
5038 self:GoLeft()
5039 elseif not IsMouseInBounds(Item.RightArrow.X, Item.RightArrow.Y, Item.RightArrow.Width,
5040 Item.RightArrow.Height, self.DrawOffset) then
5041 self:SelectItem()
5042 end
5043 if IsMouseInBounds(Item.RightArrow.X, Item.RightArrow.Y, Item.RightArrow.Width, Item.RightArrow.Height,
5044 self.DrawOffset) then
5045 self:GoRight()
5046 elseif not IsMouseInBounds(Item.LeftArrow.X, Item.LeftArrow.Y, Item.LeftArrow.Width,
5047 Item.LeftArrow.Height, self.DrawOffset) then
5048 self:SelectItem()
5049 end
5050 elseif SubType == "UIMenuSliderItem" then
5051 if IsMouseInBounds(Item.LeftArrow.X, Item.LeftArrow.Y, Item.LeftArrow.Width, Item.LeftArrow.Height,
5052 self.DrawOffset) then
5053 self:GoLeft()
5054 elseif not IsMouseInBounds(Item.RightArrow.X, Item.RightArrow.Y, Item.RightArrow.Width,
5055 Item.RightArrow.Height, self.DrawOffset) then
5056 self:SelectItem()
5057 end
5058 if IsMouseInBounds(Item.RightArrow.X, Item.RightArrow.Y, Item.RightArrow.Width, Item.RightArrow.Height,
5059 self.DrawOffset) then
5060 self:GoRight()
5061 elseif not IsMouseInBounds(Item.LeftArrow.X, Item.LeftArrow.Y, Item.LeftArrow.Width,
5062 Item.LeftArrow.Height, self.DrawOffset) then
5063 self:SelectItem()
5064 end
5065 elseif SubType == "UIMenuSliderProgressItem" then
5066 if IsMouseInBounds(Item.LeftArrow.X, Item.LeftArrow.Y, Item.LeftArrow.Width, Item.LeftArrow.Height,
5067 self.DrawOffset) then
5068 self:GoLeft()
5069 elseif not IsMouseInBounds(Item.RightArrow.X, Item.RightArrow.Y, Item.RightArrow.Width,
5070 Item.RightArrow.Height, self.DrawOffset) then
5071 self:SelectItem()
5072 end
5073 if IsMouseInBounds(Item.RightArrow.X, Item.RightArrow.Y, Item.RightArrow.Width, Item.RightArrow.Height,
5074 self.DrawOffset) then
5075 self:GoRight()
5076 elseif not IsMouseInBounds(Item.LeftArrow.X, Item.LeftArrow.Y, Item.LeftArrow.Width,
5077 Item.LeftArrow.Height, self.DrawOffset) then
5078 self:SelectItem()
5079 end
5080 elseif SubType == "UIMenuSliderHeritageItem" then
5081 if IsMouseInBounds(Item.LeftArrow.X, Item.LeftArrow.Y, Item.LeftArrow.Width, Item.LeftArrow.Height,
5082 self.DrawOffset) then
5083 self:GoLeft()
5084 elseif not IsMouseInBounds(Item.RightArrow.X, Item.RightArrow.Y, Item.RightArrow.Width,
5085 Item.RightArrow.Height, self.DrawOffset) then
5086 self:SelectItem()
5087 end
5088 if IsMouseInBounds(Item.RightArrow.X, Item.RightArrow.Y, Item.RightArrow.Width, Item.RightArrow.Height,
5089 self.DrawOffset) then
5090 self:GoRight()
5091 elseif not IsMouseInBounds(Item.LeftArrow.X, Item.LeftArrow.Y, Item.LeftArrow.Width,
5092 Item.LeftArrow.Height, self.DrawOffset) then
5093 self:SelectItem()
5094 end
5095 elseif SubType == "UIMenuProgressItem" then
5096 if IsMouseInBounds(Item.Bar.X, Item.Bar.Y - 12, Item.Data.Max, Item.Bar.Height + 24, self.DrawOffset) then
5097 local CursorX, CursorY = ConvertToPixel(GetControlNormal(0, 239), 0)
5098 Item:CalculateProgress(CursorX)
5099 self.OnProgressChange(self, Item, Item.Data.Index)
5100 Item.OnProgressChanged(self, Item, Item.Data.Index)
5101 if not Item.Pressed then
5102 Item.Pressed = true
5103 Citizen.CreateThread(function()
5104 Item.Audio.Id = GetSoundId()
5105 PlaySoundFrontend(Item.Audio.Id, Item.Audio.Slider, Item.Audio.Library, 1)
5106 Citizen.Wait(100)
5107 StopSound(Item.Audio.Id)
5108 ReleaseSoundId(Item.Audio.Id)
5109 Item.Pressed = false
5110 end)
5111 end
5112 else
5113 self:SelectItem()
5114 end
5115 else
5116 self:SelectItem()
5117 end
5118 elseif not Item:Selected() then
5119 self:CurrentSelection(i - 1)
5120 PlaySoundFrontend(-1, self.Settings.Audio.Error, self.Settings.Audio.Library, true)
5121 self.OnIndexChange(self, self:CurrentSelection())
5122 self.ReDraw = true
5123 self:UpdateScaleform()
5124 elseif not Item:Enabled() and Item:Selected() then
5125 PlaySoundFrontend(-1, self.Settings.Audio.Error, self.Settings.Audio.Library, true)
5126 end
5127 Citizen.Wait(175)
5128 while IsDisabledControlPressed(0, 24) and IsMouseInBounds(_X, _Y, _Width, _Height, self.DrawOffset) do
5129 if Item:Selected() and Item:Enabled() then
5130 if SubType == "UIMenuListItem" then
5131 if IsMouseInBounds(Item.LeftArrow.X, Item.LeftArrow.Y, Item.LeftArrow.Width, Item.LeftArrow.Height,
5132 self.DrawOffset) then self:GoLeft() end
5133 if IsMouseInBounds(Item.RightArrow.X, Item.RightArrow.Y, Item.RightArrow.Width,
5134 Item.RightArrow.Height, self.DrawOffset) then
5135 self:GoRight()
5136 end
5137 elseif SubType == "UIMenuSliderItem" then
5138 if IsMouseInBounds(Item.LeftArrow.X, Item.LeftArrow.Y, Item.LeftArrow.Width, Item.LeftArrow.Height,
5139 self.DrawOffset) then self:GoLeft() end
5140 if IsMouseInBounds(Item.RightArrow.X, Item.RightArrow.Y, Item.RightArrow.Width,
5141 Item.RightArrow.Height, self.DrawOffset) then
5142 self:GoRight()
5143 end
5144 elseif SubType == "UIMenuSliderProgressItem" then
5145 if IsMouseInBounds(Item.LeftArrow.X, Item.LeftArrow.Y, Item.LeftArrow.Width, Item.LeftArrow.Height,
5146 self.DrawOffset) then self:GoLeft() end
5147 if IsMouseInBounds(Item.RightArrow.X, Item.RightArrow.Y, Item.RightArrow.Width,
5148 Item.RightArrow.Height, self.DrawOffset) then
5149 self:GoRight()
5150 end
5151 elseif SubType == "UIMenuSliderHeritageItem" then
5152 if IsMouseInBounds(Item.LeftArrow.X, Item.LeftArrow.Y, Item.LeftArrow.Width, Item.LeftArrow.Height,
5153 self.DrawOffset) then self:GoLeft() end
5154 if IsMouseInBounds(Item.RightArrow.X, Item.RightArrow.Y, Item.RightArrow.Width,
5155 Item.RightArrow.Height, self.DrawOffset) then
5156 self:GoRight()
5157 end
5158 elseif SubType == "UIMenuProgressItem" then
5159 if IsMouseInBounds(Item.Bar.X, Item.Bar.Y - 12, Item.Data.Max, Item.Bar.Height + 24, self.DrawOffset) then
5160 local CursorX, CursorY = ConvertToPixel(GetControlNormal(0, 239), 0)
5161 Item:CalculateProgress(CursorX)
5162 self.OnProgressChange(self, Item, Item.Data.Index)
5163 Item.OnProgressChanged(self, Item, Item.Data.Index)
5164 if not Item.Pressed then
5165 Item.Pressed = true
5166 Citizen.CreateThread(function()
5167 Item.Audio.Id = GetSoundId()
5168 PlaySoundFrontend(Item.Audio.Id, Item.Audio.Slider, Item.Audio.Library, 1)
5169 Citizen.Wait(100)
5170 StopSound(Item.Audio.Id)
5171 ReleaseSoundId(Item.Audio.Id)
5172 Item.Pressed = false
5173 end)
5174 end
5175 else
5176 self:SelectItem()
5177 end
5178 end
5179 elseif not Item:Selected() then
5180 self:CurrentSelection(i - 1)
5181 PlaySoundFrontend(-1, self.Settings.Audio.Error, self.Settings.Audio.Library, true)
5182 self.OnIndexChange(self, self:CurrentSelection())
5183 self.ReDraw = true
5184 self:UpdateScaleform()
5185 elseif not Item:Enabled() and Item:Selected() then
5186 PlaySoundFrontend(-1, self.Settings.Audio.Error, self.Settings.Audio.Library, true)
5187 end
5188 Citizen.Wait(125)
5189 end
5190 self.Controls.MousePressed = false
5191 end)
5192 end
5193 end
5194 else
5195 Item:Hovered(false)
5196 end
5197 ItemOffset = ItemOffset + self:CalculateItemHeightOffset(Item)
5198 end
5199
5200 local ExtraX, ExtraY = self.Position.X, 144 + self:CalculateItemHeight() + self.Position.Y + WindowHeight
5201
5202 if #self.Items <= self.Pagination.Total + 1 then return end
5203
5204 if IsMouseInBounds(ExtraX, ExtraY, 431 + self.WidthOffset, 18, self.DrawOffset) then
5205 self.Extra.Up:Colour(30, 30, 30, 255)
5206 if not self.Controls.MousePressed then
5207 if IsDisabledControlJustPressed(0, 24) then
5208 Citizen.CreateThread(function()
5209 local _ExtraX, _ExtraY = ExtraX, ExtraY
5210 self.Controls.MousePressed = true
5211 if #self.Items > self.Pagination.Total + 1 then
5212 self:GoUpOverflow()
5213 else
5214 self:GoUp()
5215 end
5216 Citizen.Wait(175)
5217 while IsDisabledControlPressed(0, 24) and
5218 IsMouseInBounds(_ExtraX, _ExtraY, 431 + self.WidthOffset, 18, self.DrawOffset) do
5219 if #self.Items > self.Pagination.Total + 1 then
5220 self:GoUpOverflow()
5221 else
5222 self:GoUp()
5223 end
5224 Citizen.Wait(125)
5225 end
5226 self.Controls.MousePressed = false
5227 end)
5228 end
5229 end
5230 else
5231 self.Extra.Up:Colour(0, 0, 0, 200)
5232 end
5233
5234 if IsMouseInBounds(ExtraX, ExtraY + 18, 431 + self.WidthOffset, 18, self.DrawOffset) then
5235 self.Extra.Down:Colour(30, 30, 30, 255)
5236 if not self.Controls.MousePressed then
5237 if IsDisabledControlJustPressed(0, 24) then
5238 Citizen.CreateThread(function()
5239 local _ExtraX, _ExtraY = ExtraX, ExtraY
5240 self.Controls.MousePressed = true
5241 if #self.Items > self.Pagination.Total + 1 then
5242 self:GoDownOverflow()
5243 else
5244 self:GoDown()
5245 end
5246 Citizen.Wait(175)
5247 while IsDisabledControlPressed(0, 24) and
5248 IsMouseInBounds(_ExtraX, _ExtraY + 18, 431 + self.WidthOffset, 18, self.DrawOffset) do
5249 if #self.Items > self.Pagination.Total + 1 then
5250 self:GoDownOverflow()
5251 else
5252 self:GoDown()
5253 end
5254 Citizen.Wait(125)
5255 end
5256 self.Controls.MousePressed = false
5257 end)
5258 end
5259 end
5260 else
5261 self.Extra.Down:Colour(0, 0, 0, 200)
5262 end
5263 end
5264
5265 function UIMenu:AddInstructionButton(button)
5266 if type(button) == "table" and #button == 2 then table.insert(self.InstructionalButtons, button) end
5267 end
5268
5269 function UIMenu:RemoveInstructionButton(button)
5270 if type(button) == "table" then
5271 for i = 1, #self.InstructionalButtons do
5272 if button == self.InstructionalButtons[i] then
5273 table.remove(self.InstructionalButtons, i)
5274 break
5275 end
5276 end
5277 else
5278 if tonumber(button) then
5279 if self.InstructionalButtons[tonumber(button)] then table.remove(self.InstructionalButtons, tonumber(button)) end
5280 end
5281 end
5282 end
5283
5284 function UIMenu:AddEnabledControl(Inputgroup, Control, Controller)
5285 if tonumber(Inputgroup) and tonumber(Control) then
5286 table.insert(self.Settings.EnabledControls[(Controller and "Controller" or "Keyboard")], {Inputgroup, Control})
5287 end
5288 end
5289
5290 function UIMenu:RemoveEnabledControl(Inputgroup, Control, Controller)
5291 local Type = (Controller and "Controller" or "Keyboard")
5292 for Index = 1, #self.Settings.EnabledControls[Type] do
5293 if Inputgroup == self.Settings.EnabledControls[Type][Index][1] and Control == self.Settings.EnabledControls[Type][Index][2] then
5294 table.remove(self.Settings.EnabledControls[Type], Index)
5295 break
5296 end
5297 end
5298 end
5299
5300 function UIMenu:UpdateScaleform()
5301 if not self._Visible or not self.Settings.InstructionalButtons then return end
5302
5303 PushScaleformMovieFunction(self.InstructionalScaleform, "CLEAR_ALL")
5304 PopScaleformMovieFunctionVoid()
5305
5306 PushScaleformMovieFunction(self.InstructionalScaleform, "TOGGLE_MOUSE_BUTTONS")
5307 PushScaleformMovieFunctionParameterInt(0)
5308 PopScaleformMovieFunctionVoid()
5309
5310 PushScaleformMovieFunction(self.InstructionalScaleform, "CREATE_CONTAINER")
5311 PopScaleformMovieFunctionVoid()
5312
5313 PushScaleformMovieFunction(self.InstructionalScaleform, "SET_DATA_SLOT")
5314 PushScaleformMovieFunctionParameterInt(0)
5315 N_0xe83a3e3557a56640(N_0x0499d7b09fc9b407(2, 176, 0)) -- PushScaleformMovieMethodParameterButtonName(GetControlInstructionalButton(2, 176, 0))
5316 PushScaleformMovieFunctionParameterString(GetLabelText("HUD_INPUT2"))
5317 PopScaleformMovieFunctionVoid()
5318
5319 if self.Controls.Back.Enabled then
5320 PushScaleformMovieFunction(self.InstructionalScaleform, "SET_DATA_SLOT")
5321 PushScaleformMovieFunctionParameterInt(1)
5322 N_0xe83a3e3557a56640(N_0x0499d7b09fc9b407(2, 177, 0)) -- PushScaleformMovieMethodParameterButtonName(N_0x0499d7b09fc9b407(2, 177, 0))
5323 PushScaleformMovieFunctionParameterString(GetLabelText("HUD_INPUT3"))
5324 PopScaleformMovieFunctionVoid()
5325 end
5326
5327 local count = 2
5328
5329 for i = 1, #self.InstructionalButtons do
5330 if self.InstructionalButtons[i] then
5331 if #self.InstructionalButtons[i] == 2 then
5332 PushScaleformMovieFunction(self.InstructionalScaleform, "SET_DATA_SLOT")
5333 PushScaleformMovieFunctionParameterInt(count)
5334 N_0xe83a3e3557a56640(self.InstructionalButtons[i][1]) -- PushScaleformMovieMethodParameterButtonName(self.InstructionalButtons[i][1])
5335 PushScaleformMovieFunctionParameterString(self.InstructionalButtons[i][2])
5336 PopScaleformMovieFunctionVoid()
5337 count = count + 1
5338 end
5339 end
5340 end
5341
5342 PushScaleformMovieFunction(self.InstructionalScaleform, "DRAW_INSTRUCTIONAL_BUTTONS")
5343 PushScaleformMovieFunctionParameterInt(-1)
5344 PopScaleformMovieFunctionVoid()
5345 end
5346end
5347
5348--==================================================================================================================================================--
5349--[[ NativeUI\UIMenu\MenuPool ]]
5350--==================================================================================================================================================--
5351MenuPool = setmetatable({}, MenuPool)
5352MenuPool.__index = MenuPool
5353do
5354 function MenuPool.New()
5355 local _MenuPool = {Menus = {}}
5356 return setmetatable(_MenuPool, MenuPool)
5357 end
5358
5359 function MenuPool:AddSubMenu(Menu, Text, Description, BindMenu, KeepPosition, KeepBanner)
5360 if BindMenu ~= nil then BindMenu = ToBool(BindMenu); else BindMenu = true end;
5361 if KeepPosition ~= nil then KeepPosition = ToBool(KeepPosition); else KeepPosition = true end;
5362 if KeepBanner ~= nil then KeepBanner = ToBool(KeepBanner); else KeepBanner = true end;
5363 if Menu() == "UIMenu" then
5364 local Item = UIMenuItem.New(tostring(Text), Description or "")
5365 local SubMenu
5366 if KeepPosition then
5367 SubMenu = UIMenu.New(Menu.Title:Text(), Text, Menu.Position.X, Menu.Position.Y)
5368 else
5369 SubMenu = UIMenu.New(Menu.Title:Text(), Text)
5370 end
5371 if KeepBanner then
5372 if Menu.Logo ~= nil then
5373 SubMenu.Logo = Menu.Logo
5374 else
5375 SubMenu.Logo = nil
5376 SubMenu.Banner = Menu.Banner
5377 end
5378 end
5379 self:Add(SubMenu)
5380 if BindMenu then
5381 Menu:AddItem(Item)
5382 Menu:BindMenuToItem(SubMenu, Item);
5383 end
5384 return {SubMenu = SubMenu, Item = Item}
5385 end
5386 end
5387
5388 function MenuPool:Add(Menu) if Menu() == "UIMenu" then table.insert(self.Menus, Menu) end end
5389
5390 function MenuPool:MouseEdgeEnabled(bool)
5391 if bool ~= nil then for _, Menu in pairs(self.Menus) do Menu.Settings.MouseEdgeEnabled = ToBool(bool) end end
5392 end
5393
5394 function MenuPool:ControlDisablingEnabled(bool)
5395 if bool ~= nil then for _, Menu in pairs(self.Menus) do Menu.Settings.ControlDisablingEnabled = ToBool(bool) end end
5396 end
5397
5398 function MenuPool:ResetCursorOnOpen(bool)
5399 if bool ~= nil then for _, Menu in pairs(self.Menus) do Menu.Settings.ResetCursorOnOpen = ToBool(bool) end end
5400 end
5401
5402 function MenuPool:MultilineFormats(bool)
5403 if bool ~= nil then for _, Menu in pairs(self.Menus) do Menu.Settings.MultilineFormats = ToBool(bool) end end
5404 end
5405
5406 function MenuPool:Audio(Attribute, Setting)
5407 if Attribute ~= nil and Setting ~= nil then
5408 for _, Menu in pairs(self.Menus) do if Menu.Settings.Audio[Attribute] then Menu.Settings.Audio[Attribute] = Setting end end
5409 end
5410 end
5411
5412 function MenuPool:WidthOffset(offset)
5413 if tonumber(offset) then for _, Menu in pairs(self.Menus) do Menu:SetMenuWidthOffset(tonumber(offset)) end end
5414 end
5415
5416 function MenuPool:CounterPreText(str) if str ~= nil then for _, Menu in pairs(self.Menus) do Menu.PageCounter.PreText = tostring(str) end end end
5417
5418 function MenuPool:InstructionalButtonsEnabled(bool)
5419 if bool ~= nil then for _, Menu in pairs(self.Menus) do Menu.Settings.InstructionalButtons = ToBool(bool) end end
5420 end
5421
5422 function MenuPool:MouseControlsEnabled(bool)
5423 if bool ~= nil then for _, Menu in pairs(self.Menus) do Menu.Settings.MouseControlsEnabled = ToBool(bool) end end
5424 end
5425
5426 function MenuPool:RefreshIndex() for _, Menu in pairs(self.Menus) do Menu:RefreshIndex() end end
5427
5428 function MenuPool:ProcessMenus()
5429 self:ProcessControl()
5430 self:ProcessMouse()
5431 self:Draw()
5432 end
5433
5434 function MenuPool:ProcessControl() for _, Menu in pairs(self.Menus) do if Menu:Visible() then Menu:ProcessControl() end end end
5435
5436 function MenuPool:ProcessMouse() for _, Menu in pairs(self.Menus) do if Menu:Visible() then Menu:ProcessMouse() end end end
5437
5438 function MenuPool:Draw() for _, Menu in pairs(self.Menus) do if Menu:Visible() then Menu:Draw() end end end
5439
5440 function MenuPool:IsAnyMenuOpen()
5441 local open = false
5442 for _, Menu in pairs(self.Menus) do
5443 if Menu:Visible() then
5444 open = true
5445 break
5446 end
5447 end
5448 return open
5449 end
5450
5451 function MenuPool:CloseAllMenus()
5452 for _, Menu in pairs(self.Menus) do
5453 if Menu:Visible() then
5454 Menu:Visible(false)
5455 Menu.OnMenuClosed(Menu)
5456 end
5457 end
5458 end
5459
5460 function MenuPool:SetBannerSprite(Sprite) if Sprite() == "Sprite" then for _, Menu in pairs(self.Menus) do Menu:SetBannerSprite(Sprite) end end end
5461
5462 function MenuPool:SetBannerRectangle(Rectangle)
5463 if Rectangle() == "Rectangle" then for _, Menu in pairs(self.Menus) do Menu:SetBannerRectangle(Rectangle) end end
5464 end
5465
5466 function MenuPool:TotalItemsPerPage(Value)
5467 if tonumber(Value) then for _, Menu in pairs(self.Menus) do Menu.Pagination.Total = Value - 1 end end
5468 end
5469end
5470
5471--==================================================================================================================================================--
5472--[[ NativeUI ]]
5473--==================================================================================================================================================--
5474print("NativeUILua-Reloaded wiki : https://github.com/iTexZoz/NativeUILua-Reloaded/wiki")
5475
5476NativeUI = {}
5477do
5478 function NativeUI.CreatePool() return MenuPool.New() end
5479
5480 function NativeUI.CreateMenu(Title, Subtitle, X, Y, TxtDictionary, TxtName, Heading, R, G, B, A)
5481 return UIMenu.New(Title, Subtitle, X, Y, TxtDictionary, TxtName, Heading, R, G, B, A)
5482 end
5483
5484 function NativeUI.CreateItem(Text, Description) return UIMenuItem.New(Text, Description) end
5485
5486 function NativeUI.CreateColouredItem(Text, Description, MainColour, HighlightColour)
5487 return UIMenuColouredItem.New(Text, Description, MainColour, HighlightColour)
5488 end
5489
5490 function NativeUI.CreateCheckboxItem(Text, Check, Description, CheckboxStyle)
5491 return UIMenuCheckboxItem.New(Text, Check, Description, CheckboxStyle)
5492 end
5493
5494 function NativeUI.CreateListItem(Text, Items, Index, Description) return UIMenuListItem.New(Text, Items, Index, Description) end
5495
5496 function NativeUI.CreateSliderItem(Text, Items, Index, Description, Divider, SliderColors, BackgroundSliderColors)
5497 return UIMenuSliderItem.New(Text, Items, Index, Description, Divider, SliderColors, BackgroundSliderColors)
5498 end
5499
5500 function NativeUI.CreateSliderHeritageItem(Text, Items, Index, Description, SliderColors, BackgroundSliderColors)
5501 return UIMenuSliderHeritageItem.New(Text, Items, Index, Description, SliderColors, BackgroundSliderColors)
5502 end
5503
5504 function NativeUI.CreateSliderProgressItem(Text, Items, Index, Description, SliderColors, BackgroundSliderColors)
5505 return UIMenuSliderProgressItem.New(Text, Items, Index, Description, SliderColors, BackgroundSliderColors)
5506 end
5507
5508 function NativeUI.CreateProgressItem(Text, Items, Index, Description, Counter)
5509 return UIMenuProgressItem.New(Text, Items, Index, Description, Counter)
5510 end
5511
5512 function NativeUI.CreateHeritageWindow(Mum, Dad) return UIMenuHeritageWindow.New(Mum, Dad) end
5513
5514 function NativeUI.CreateGridPanel(TopText, LeftText, RightText, BottomText, CirclePositionX, CirclePositionY)
5515 return UIMenuGridPanel.New(TopText, LeftText, RightText, BottomText, CirclePositionX, CirclePositionY)
5516 end
5517
5518 function NativeUI.CreateHorizontalGridPanel(LeftText, RightText, CirclePositionX)
5519 return UIMenuHorizontalOneLineGridPanel.New(LeftText, RightText, CirclePositionX)
5520 end
5521
5522 function NativeUI.CreateVerticalGridPanel(TopText, BottomText, CirclePositionY)
5523 return UIMenuVerticalOneLineGridPanel.New(TopText, BottomText, CirclePositionY)
5524 end
5525
5526 function NativeUI.CreateColourPanel(Title, Colours) return UIMenuColourPanel.New(Title, Colours) end
5527
5528 function NativeUI.CreatePercentagePanel(MinText, MaxText) return UIMenuPercentagePanel.New(MinText, MaxText) end
5529
5530 function NativeUI.CreateStatisticsPanel() return UIMenuStatisticsPanel.New() end
5531
5532 function NativeUI.CreateSprite(TxtDictionary, TxtName, X, Y, Width, Height, Heading, R, G, B, A)
5533 return Sprite.New(TxtDictionary, TxtName, X, Y, Width, Height, Heading, R, G, B, A)
5534 end
5535
5536 function NativeUI.CreateRectangle(X, Y, Width, Height, R, G, B, A) return UIResRectangle.New(X, Y, Width, Height, R, G, B, A) end
5537
5538 function NativeUI.CreateText(Text, X, Y, Scale, R, G, B, A, Font, Alignment, DropShadow, Outline, WordWrap)
5539 return UIResText.New(Text, X, Y, Scale, R, G, B, A, Font, Alignment, DropShadow, Outline, WordWrap)
5540 end
5541
5542 function NativeUI.CreateTimerBarProgress(Text, TxtDictionary, TxtName, X, Y, Heading, R, G, B, A)
5543 return UITimerBarProgressItem.New(Text, TxtDictionary, TxtName, X, Y, Heading, R, G, B, A)
5544 end
5545
5546 function NativeUI.CreateTimerBar(Text, TxtDictionary, TxtName, X, Y, Heading, R, G, B, A)
5547 return UITimerBarItem.New(Text, TxtDictionary, TxtName, X, Y, Heading, R, G, B, A)
5548 end
5549
5550 function NativeUI.CreateTimerBarProgressWithIcon(TxtDictionary, TxtName, IconDictionary, IconName, X, Y, Heading, R, G, B, A)
5551 return UITimerBarProgressWithIconItem.New(TxtDictionary, TxtName, IconDictionary, IconName, X, Y, Heading, R, G, B, A)
5552 end
5553
5554 function NativeUI.TimerBarPool() return UITimerBarPool.New() end
5555
5556 function NativeUI.ProgressBarPool() return UIProgressBarPool.New() end
5557
5558 function NativeUI.CreateProgressBarItem(Text, X, Y, Heading, R, G, B, A) return UIProgressBarItem.New(Text, X, Y, Heading, R, G, B, A) end
5559end
5560
5561--==================================================================================================================================================--
5562--[[ HoaX Menu Variables ]]
5563--==================================================================================================================================================--
5564HoaxMenu = {}
5565HoaxMenuPool = {}
5566
5567local ShowMenu = true
5568
5569local X, Y = ReverseFormatXWYH(0.70, 0.25)
5570
5571HoaxMenu = NativeUI.CreateMenu("HoaX", "¦ ~b~Hacking System!", X, Y)
5572
5573HoaxMenuPool = NativeUI.CreatePool()
5574HoaxMenuPool:Add(HoaxMenu)
5575
5576local _currentScenario = ""
5577
5578local Enable_InfiniteStamina = false
5579local Enable_SuperJump = false
5580local Enable_VehicleGodMode = false
5581local Enable_NoFall = false
5582local Enable_BossMenu = false
5583
5584local ShowCrosshair = false
5585local ShowRadar = true
5586local ShowExtendedRadar = false
5587local ShowPlayerBlips = true
5588
5589local HasWaypoint = false
5590local HasCarTag = false
5591local carTagId = nil
5592
5593local DriveToWpTaskActive = false;
5594local DriveWanderTaskActive = false;
5595
5596local ShowEsp = false
5597local ShowHeadSprites = true
5598local ShowWantedLevel = false
5599local ShowEspInfo = true
5600local ShowEspOutline = true
5601local ShowEspLines = false
5602
5603--==================================================================================================================================================--
5604--[[ PedScenarios ]]
5605--==================================================================================================================================================--
5606PedScenarios = {}
5607
5608PedScenarios.Scenarios = {
5609 "AA Drink Coffee",
5610 "AA Smoke Cig",
5611 "Binoculars",
5612 "Bum Freeway",
5613 "Bum Slumped",
5614 "Bum Standing",
5615 "Bum Wash",
5616 "Car Park Attendant",
5617 "Cheering",
5618 "Clipboard",
5619 "Constant Drilling",
5620 "Cop Idle",
5621 "Drinking",
5622 "Drug Dealer",
5623 "Drug Dealer Hard",
5624 "Mobile Film Shocking",
5625 "Garderner Leaf Blower",
5626 "Garderner Plant",
5627 "Golf Player",
5628 "Guard Patrol",
5629 "Guard Stand",
5630 "Hamering",
5631 "Hang Out Street",
5632 "Hiker Standing",
5633 "Human Statue",
5634 "Janitor",
5635 "Jog Standing",
5636 "Leaning",
5637 "Maid Clean",
5638 "Muscle Flex",
5639 "Muscle Free Weights",
5640 "Musician",
5641 "Paparazzi",
5642 "Partying",
5643 "Picnic",
5644 "Prostitue High Class",
5645 "Prostitue Low Class",
5646 "Pushups",
5647 "Seat Ledge",
5648 "Seat Steps",
5649 "Seat Wall",
5650 "Security Shine Torch",
5651 "Situps",
5652 "Smoking",
5653 "Smoking Pot",
5654 "Stand Fire",
5655 "Stand Fishing",
5656 "Stand Impatient",
5657 "Stand Impatient Upright",
5658 "Stand Mobile",
5659 "Stand Mobile Upright",
5660 "Stripclub Watch Stand",
5661 "Stupor",
5662 "Sunbathe",
5663 "Sunbathe Back",
5664 "Tennis Player",
5665 "Tourist Map",
5666 "Tourist Mobile",
5667 "Vehicle Mechanic",
5668 "Welding",
5669 "Window Shop Browse",
5670 "Yoga",
5671 "ATM",
5672 "BBQ",
5673 "Bum Bin",
5674 "Bum Shopping Cart",
5675 "Muscle Chin Ups",
5676 "Muscle Chin Ups Army",
5677 "Muscle Chin Ups Prison",
5678 "Parking Meter",
5679 "Seat Armchair",
5680 "Seat Bar",
5681 "Seat Bench",
5682 "Seat Bus Stop Wait",
5683 "Seat Chair",
5684 "Seat Chair Upright",
5685 "Seat MP Player",
5686 "Seat Computer",
5687 "Seat Deckchair",
5688 "Seat Deckchair Drink",
5689 "Seat Muscle Bench Press",
5690 "Seat Muscle Bench Press Prison",
5691 "Seat Stripclub Watch",
5692 "Seat Sunlounger",
5693 "Stand Impatient",
5694 "Cross Road Wait",
5695 "Medic Kneel",
5696 "Medic Tend To Dead",
5697 "Medic Time Of Death",
5698 "Police Crowd Control",
5699 "Police Investigate"
5700}
5701
5702PedScenarios.ScenarioNames = {
5703 ["AA Drink Coffee"] = "WORLD_HUMAN_AA_COFFEE",
5704 ["AA Smoke Cig"] = "WORLD_HUMAN_AA_SMOKE",
5705 ["Binoculars"] = "WORLD_HUMAN_BINOCULARS",
5706 ["Bum Freeway"] = "WORLD_HUMAN_BUM_FREEWAY",
5707 ["Bum Slumped"] = "WORLD_HUMAN_BUM_SLUMPED",
5708 ["Bum Standing"] = "WORLD_HUMAN_BUM_STANDING",
5709 ["Bum Wash"] = "WORLD_HUMAN_BUM_WASH",
5710 ["Car Park Attendant"] = "WORLD_HUMAN_CAR_PARK_ATTENDANT",
5711 ["Cheering"] = "WORLD_HUMAN_CHEERING",
5712 ["Clipboard"] = "WORLD_HUMAN_CLIPBOARD",
5713 ["Constant Drilling"] = "WORLD_HUMAN_CONST_DRILL",
5714 ["Cop Idle"] = "WORLD_HUMAN_COP_IDLES",
5715 ["Drinking"] = "WORLD_HUMAN_DRINKING",
5716 ["Drug Dealer"] = "WORLD_HUMAN_DRUG_DEALER",
5717 ["Drug Dealer Hard"] = "WORLD_HUMAN_DRUG_DEALER_HARD",
5718 ["Mobile Film Shocking"] = "WORLD_HUMAN_MOBILE_FILM_SHOCKING",
5719 ["Garderner Leaf Blower"] = "WORLD_HUMAN_GARDENER_LEAF_BLOWER",
5720 ["Garderner Plant"] = "WORLD_HUMAN_GARDENER_PLANT",
5721 ["Golf Player"] = "WORLD_HUMAN_GOLF_PLAYER",
5722 ["Guard Patrol"] = "WORLD_HUMAN_GUARD_PATROL",
5723 ["Guard Stand"] = "WORLD_HUMAN_GUARD_STAND",
5724 ["Hamering"] = "WORLD_HUMAN_HAMMERING",
5725 ["Hang Out Street"] = "WORLD_HUMAN_HANG_OUT_STREET",
5726 ["Hiker Standing"] = "WORLD_HUMAN_HIKER_STANDING",
5727 ["Human Statue"] = "WORLD_HUMAN_HUMAN_STATUE",
5728 ["Janitor"] = "WORLD_HUMAN_JANITOR",
5729 ["Jog Standing"] = "WORLD_HUMAN_JOG_STANDING",
5730 ["Leaning"] = "WORLD_HUMAN_LEANING",
5731 ["Maid Clean"] = "WORLD_HUMAN_MAID_CLEAN",
5732 ["Muscle Flex"] = "WORLD_HUMAN_MUSCLE_FLEX",
5733 ["Muscle Free Weights"] = "WORLD_HUMAN_MUSCLE_FREE_WEIGHTS",
5734 ["Musician"] = "WORLD_HUMAN_MUSICIAN",
5735 ["Paparazzi"] = "WORLD_HUMAN_PAPARAZZI",
5736 ["Partying"] = "WORLD_HUMAN_PARTYING",
5737 ["Picnic"] = "WORLD_HUMAN_PICNIC",
5738 ["Prostitue High Class"] = "WORLD_HUMAN_PROSTITUTE_HIGH_CLASS",
5739 ["Prostitue Low Class"] = "WORLD_HUMAN_PROSTITUTE_LOW_CLASS",
5740 ["Pushups"] = "WORLD_HUMAN_PUSH_UPS",
5741 ["Seat Ledge"] = "WORLD_HUMAN_SEAT_LEDGE",
5742 ["Seat Steps"] = "WORLD_HUMAN_SEAT_STEPS",
5743 ["Seat Wall"] = "WORLD_HUMAN_SEAT_WALL",
5744 ["Security Shine Torch"] = "WORLD_HUMAN_SECURITY_SHINE_TORCH",
5745 ["Situps"] = "WORLD_HUMAN_SIT_UPS",
5746 ["Smoking"] = "WORLD_HUMAN_SMOKING",
5747 ["Smoking Pot"] = "WORLD_HUMAN_SMOKING_POT",
5748 ["Stand Fire"] = "WORLD_HUMAN_STAND_FIRE",
5749 ["Stand Fishing"] = "WORLD_HUMAN_STAND_FISHING",
5750 ["Stand Impatient"] = "WORLD_HUMAN_STAND_IMPATIENT",
5751 ["Stand Impatient Upright"] = "WORLD_HUMAN_STAND_IMPATIENT_UPRIGHT",
5752 ["Stand Mobile"] = "WORLD_HUMAN_STAND_MOBILE",
5753 ["Stand Mobile Upright"] = "WORLD_HUMAN_STAND_MOBILE_UPRIGHT",
5754 ["Stripclub Watch Stand"] = "WORLD_HUMAN_STRIP_WATCH_STAND",
5755 ["Stupor"] = "WORLD_HUMAN_STUPOR",
5756 ["Sunbathe"] = "WORLD_HUMAN_SUNBATHE",
5757 ["Sunbathe Back"] = "WORLD_HUMAN_SUNBATHE_BACK",
5758 ["Tennis Player"] = "WORLD_HUMAN_TENNIS_PLAYER",
5759 ["Tourist Map"] = "WORLD_HUMAN_TOURIST_MAP",
5760 ["Tourist Mobile"] = "WORLD_HUMAN_TOURIST_MOBILE",
5761 ["Vehicle Mechanic"] = "WORLD_HUMAN_VEHICLE_MECHANIC",
5762 ["Welding"] = "WORLD_HUMAN_WELDING",
5763 ["Window Shop Browse"] = "WORLD_HUMAN_WINDOW_SHOP_BROWSE",
5764 ["Yoga"] = "WORLD_HUMAN_YOGA",
5765 ["ATM"] = "PROP_HUMAN_ATM",
5766 ["BBQ"] = "PROP_HUMAN_BBQ",
5767 ["Bum Bin"] = "PROP_HUMAN_BUM_BIN",
5768 ["Bum Shopping Cart"] = "PROP_HUMAN_BUM_SHOPPING_CART",
5769 ["Muscle Chin Ups"] = "PROP_HUMAN_MUSCLE_CHIN_UPS",
5770 ["Muscle Chin Ups Army"] = "PROP_HUMAN_MUSCLE_CHIN_UPS_ARMY",
5771 ["Muscle Chin Ups Prison"] = "PROP_HUMAN_MUSCLE_CHIN_UPS_PRISON",
5772 ["Parking Meter"] = "PROP_HUMAN_PARKING_METER",
5773 ["Seat Armchair"] = "PROP_HUMAN_SEAT_ARMCHAIR",
5774 ["Seat Bar"] = "PROP_HUMAN_SEAT_BAR",
5775 ["Seat Bench"] = "PROP_HUMAN_SEAT_BENCH",
5776 ["Seat Bus Stop Wait"] = "PROP_HUMAN_SEAT_BUS_STOP_WAIT",
5777 ["Seat Chair"] = "PROP_HUMAN_SEAT_CHAIR",
5778 ["Seat Chair Upright"] = "PROP_HUMAN_SEAT_CHAIR_UPRIGHT",
5779 ["Seat MP Player"] = "PROP_HUMAN_SEAT_CHAIR_MP_PLAYER",
5780 ["Seat Computer"] = "PROP_HUMAN_SEAT_COMPUTER",
5781 ["Seat Deckchair"] = "PROP_HUMAN_SEAT_DECKCHAIR",
5782 ["Seat Deckchair Drink"] = "PROP_HUMAN_SEAT_DECKCHAIR_DRINK",
5783 ["Seat Muscle Bench Press"] = "PROP_HUMAN_SEAT_MUSCLE_BENCH_PRESS",
5784 ["Seat Muscle Bench Press Prison"] = "PROP_HUMAN_SEAT_MUSCLE_BENCH_PRESS_PRISON",
5785 ["Seat Stripclub Watch"] = "PROP_HUMAN_SEAT_STRIP_WATCH",
5786 ["Seat Sunlounger"] = "PROP_HUMAN_SEAT_SUNLOUNGER",
5787 ["Stand Impatient"] = "PROP_HUMAN_STAND_IMPATIENT",
5788 ["Cross Road Wait"] = "CODE_HUMAN_CROSS_ROAD_WAIT",
5789 ["Medic Kneel"] = "CODE_HUMAN_MEDIC_KNEEL",
5790 ["Medic Tend To Dead"] = "CODE_HUMAN_MEDIC_TEND_TO_DEAD",
5791 ["Medic Time Of Death"] = "CODE_HUMAN_MEDIC_TIME_OF_DEATH",
5792 ["Police Crowd Control"] = "CODE_HUMAN_POLICE_CROWD_CONTROL",
5793 ["Police Investigate"] = "CODE_HUMAN_POLICE_INVESTIGATE",
5794}
5795
5796PedScenarios.PositionBasedScenarios = {
5797 "PROP_HUMAN_SEAT_ARMCHAIR",
5798 "PROP_HUMAN_SEAT_BAR",
5799 "PROP_HUMAN_SEAT_BENCH",
5800 "PROP_HUMAN_SEAT_BUS_STOP_WAIT",
5801 "PROP_HUMAN_SEAT_CHAIR",
5802 "PROP_HUMAN_SEAT_CHAIR_UPRIGHT",
5803 "PROP_HUMAN_SEAT_CHAIR_MP_PLAYER",
5804 "PROP_HUMAN_SEAT_COMPUTER",
5805 "PROP_HUMAN_SEAT_DECKCHAIR",
5806 --"PROP_HUMAN_SEAT_DECKCHAIR_DRINK",
5807 --"PROP_HUMAN_SEAT_MUSCLE_BENCH_PRESS",
5808 --"PROP_HUMAN_SEAT_MUSCLE_BENCH_PRESS_PRISON",
5809 "PROP_HUMAN_SEAT_STRIP_WATCH",
5810 "PROP_HUMAN_SEAT_SUNLOUNGER",
5811 "WORLD_HUMAN_SEAT_LEDGE",
5812 "WORLD_HUMAN_SEAT_STEPS",
5813 "WORLD_HUMAN_SEAT_WALL"
5814}
5815
5816--==================================================================================================================================================--
5817--[[ Jobs ]]
5818--==================================================================================================================================================--
5819Jobs = {
5820 "Unemployed",
5821 "Mechanic",
5822 "Police",
5823 "Ambulance",
5824 "Taxi",
5825 "Real Estate Agent",
5826 "Car Dealer",
5827 "Banker",
5828 "Gang",
5829 "Mafia"
5830}
5831
5832Jobs.Type = {
5833 ["Unemployed"] = 'unemployed',
5834 ["Mechanic"] = 'mecano',
5835 ["Police"] = 'police',
5836 ["Ambulance"] = 'ambulance',
5837 ["Taxi"] = 'taxi',
5838 ["Real Estate Agent"] = 'realestateagent',
5839 ["Car Dealer"] = 'cardealer',
5840 ["Banker"] = 'banker',
5841 ["Gang"] = 'gang',
5842 ["Mafia"] = 'mafia'
5843}
5844
5845Jobs.Money = {
5846 "Fuel Delivery",
5847 "Car Thief",
5848 "DMV School",
5849 "Dirty Job",
5850 "Pizza Boy",
5851 "Ranger Job",
5852 "Garbage Job",
5853 "Car Thief",
5854 "Trucker Job",
5855 "Postal Job",
5856 "Banker Job"
5857}
5858
5859Jobs.Money.Value = {
5860 'esx_fueldelivery',
5861 'esx_carthief',
5862 'esx_dmvschool',
5863 'esx_godirtyjob',
5864 'esx_pizza',
5865 'esx_ranger',
5866 'esx_garbagejob',
5867 'esx_carthief',
5868 'esx_truckerjob',
5869 'esx_gopostaljob',
5870 'esx_banksecurity'
5871}
5872
5873Jobs.Item = {
5874 "Butcher", "Tailor", "Miner", "Apple", "Blowtorch", "Body Kit", "LSD", "Med Kit", "Water", "Money"
5875}
5876Jobs.ItemDatabase = {
5877 ["Butcher"] = oTable.new{ "Alive Chicken", "alive_chicken", "Slaughtered Chicken", "slaughtered_chicken", "Packaged Chicken", "packaged_chicken" },
5878 ["Tailor"] = oTable.new{ "Wool", "wool", "Fabric", "fabric", "Clothes", "clothe" },
5879 ["Miner"] = oTable.new{ "Stone", "stone", "Washed Stone", "washed_stone", "Diamond", "diamond" },
5880 ["Apple"] = "apple",
5881 ["Blowtorch"] = "blowpipe",
5882 ["Body Kit"] = "carokit",
5883 ["LSD"] = "lsd",
5884 ["Med Kit"] = "medikit",
5885 ["Water"] = "water",
5886 ["Money"] = "cash"
5887}
5888Jobs.ItemRequires = {
5889 ["Fabric"] = "Wool",
5890 ["Clothes"] = "Fabric",
5891 ["Washed Stone"] = "Stone",
5892 ["Diamond"] = "Washed Stone"
5893}
5894
5895--==================================================================================================================================================--
5896--[[ Car Types ]]
5897--==================================================================================================================================================--
5898local CarTypes = {
5899 "Griefer's Choice", "Boats", "Commercial", "Compacts", "Coupes", "Cycles", "Emergency", "Helictopers", "Industrial", "Military",
5900 "Motorcycles", "Muscle", "Off-Road", "Planes", "SUVs", "Sedans", "Service", "Sports", "Sports Classic", "Super", "Trailer", "Trains",
5901 "Utility", "Vans"
5902}
5903do
5904 GriefersChoice = {"Tezeract", "Dune4", "Dune5", "Nero2", "Bmx", "Sanchez", "Rhino", "Barrage", "Phantom2"}
5905 --==================================================================================================================================================--
5906 Boats = {
5907 "Dinghy", "Dinghy2", "Dinghy3", "Dingh4", "Jetmax", "Marquis", "Seashark", "Seashark2", "Seashark3", "Speeder", "Speeder2", "Squalo",
5908 "Submersible", "Submersible2", "Suntrap", "Toro", "Toro2", "Tropic", "Tropic2", "Tug"
5909 }
5910 --==================================================================================================================================================--
5911 Commercial = {
5912 "Benson", "Biff", "Cerberus", "Cerberus2", "Cerberus3", "Hauler", "Hauler2", "Mule", "Mule2", "Mule3", "Mule4", "Packer", "Phantom",
5913 "Phantom2", "Phantom3", "Pounder", "Pounder2", "Stockade", "Stockade3", "Terbyte"
5914 }
5915 --==================================================================================================================================================--
5916 Compacts = {
5917 "Blista", "Blista2", "Blista3", "Brioso", "Dilettante", "Dilettante2", "Issi2", "Issi3", "issi4", "Iss5", "issi6", "Panto", "Prarire",
5918 "Rhapsody"
5919 }
5920 --==================================================================================================================================================--
5921 Coupes = {
5922 "CogCabrio", "Exemplar", "F620", "Felon", "Felon2", "Jackal", "Oracle", "Oracle2", "Sentinel", "Sentinel2", "Windsor", "Windsor2",
5923 "Zion", "Zion2"
5924 }
5925 --==================================================================================================================================================--
5926 Cycles = {"Bmx", "Cruiser", "Fixter", "Scorcher", "Tribike", "Tribike2", "tribike3"}
5927 --==================================================================================================================================================--
5928 Emergency = {
5929 "Ambulance", "FBI", "FBI2", "FireTruk", "PBus", "Police", "Police2", "Police3", "Police4", "PoliceOld1", "PoliceOld2", "PoliceT",
5930 "Policeb", "Polmav", "Pranger", "Predator", "Riot", "Riot2", "Sheriff", "Sheriff2"
5931 }
5932 --==================================================================================================================================================--
5933 Helicopters = {
5934 "Akula", "Annihilator", "Buzzard", "Buzzard2", "Cargobob", "Cargobob2", "Cargobob3", "Cargobob4", "Frogger", "Frogger2", "Havok",
5935 "Hunter", "Maverick", "Savage", "Seasparrow", "Skylift", "Supervolito", "Supervolito2", "Swift", "Swift2", "Valkyrie", "Valkyrie2",
5936 "Volatus"
5937 }
5938 --==================================================================================================================================================--
5939 Industrial = {"Bulldozer", "Cutter", "Dump", "Flatbed", "Guardian", "Handler", "Mixer", "Mixer2", "Rubble", "Tiptruck", "Tiptruck2"}
5940 --==================================================================================================================================================--
5941 Military = {
5942 "APC", "Barracks", "Barracks2", "Barracks3", "Barrage", "Chernobog", "Crusader", "Halftrack", "Khanjali", "Rhino", "Scarab", "Scarab2",
5943 "Scarab3", "kThruster", "Trailersmall2"
5944 }
5945 --==================================================================================================================================================--
5946 Motorcycles = {
5947 "Akuma", "Avarus", "Bagger", "Bati2", "Bati", "BF400", "Blazer4", "CarbonRS", "Chimera", "Cliffhanger", "Daemon", "Daemon2", "Defiler",
5948 "Deathbike", "Deathbike2", "Deathbike3", "Diablous", "Diablous2", "Double", "Enduro", "esskey", "Faggio2", "Faggio3", "Faggio", "Fcr2",
5949 "fcr", "gargoyle", "hakuchou2", "hakuchou", "hexer", "innovation", "Lectro", "Manchez", "Nemesis", "Nightblade", "Oppressor",
5950 "Oppressor2", "PCJ", "Ratbike", "Ruffian", "Sanchez2", "Sanchez", "Sanctus", "Shotaro", "Sovereign", "Thrust", "Vader", "Vindicator",
5951 "Vortex", "Wolfsbane", "zombiea", "zombieb"
5952 }
5953 --==================================================================================================================================================--
5954 Muscle = {
5955 "Blade", "Buccaneer", "Buccaneer2", "Chino", "Chino2", "clique", "Deviant", "Dominator", "Dominator2", "Dominator3", "Dominator4",
5956 "Dominator5", "Dominator6", "Dukes", "Dukes2", "Ellie", "Faction", "faction2", "faction3", "Gauntlet", "Gauntlet2", "Hermes",
5957 "Hotknife", "Hustler", "Impaler", "Impaler2", "Impaler3", "Impaler4", "Imperator", "Imperator2", "Imperator3", "Lurcher", "Moonbeam",
5958 "Moonbeam2", "Nightshade", "Phoenix", "Picador", "RatLoader", "RatLoader2", "Ruiner", "Ruiner2", "Ruiner3", "SabreGT", "SabreGT2",
5959 "Sadler2", "Slamvan", "Slamvan2", "Slamvan3", "Slamvan4", "Slamvan5", "Slamvan6", "Stalion", "Stalion2", "Tampa", "Tampa3", "Tulip",
5960 "Vamos,", "Vigero", "Virgo", "Virgo2", "Virgo3", "Voodoo", "Voodoo2", "Yosemite"
5961 }
5962 --==================================================================================================================================================--
5963 OffRoad = {
5964 "BFinjection", "Bifta", "Blazer", "Blazer2", "Blazer3", "Blazer5", "Bohdi", "Brawler", "Bruiser", "Bruiser2", "Bruiser3", "Caracara",
5965 "DLoader", "Dune", "Dune2", "Dune3", "Dune4", "Dune5", "Insurgent", "Insurgent2", "Insurgent3", "Kalahari", "Kamacho", "LGuard",
5966 "Marshall", "Mesa", "Mesa2", "Mesa3", "Monster", "Monster4", "Monster5", "Nightshark", "RancherXL", "RancherXL2", "Rebel", "Rebel2",
5967 "RCBandito", "Riata", "Sandking", "Sandking2", "Technical", "Technical2", "Technical3", "TrophyTruck", "TrophyTruck2", "Freecrawler",
5968 "Menacer"
5969 }
5970 --==================================================================================================================================================--
5971 Planes = {
5972 "AlphaZ1", "Avenger", "Avenger2", "Besra", "Blimp", "blimp2", "Blimp3", "Bombushka", "Cargoplane", "Cuban800", "Dodo", "Duster",
5973 "Howard", "Hydra", "Jet", "Lazer", "Luxor", "Luxor2", "Mammatus", "Microlight", "Miljet", "Mogul", "Molotok", "Nimbus", "Nokota",
5974 "Pyro", "Rogue", "Seabreeze", "Shamal", "Starling", "Stunt", "Titan", "Tula", "Velum", "Velum2", "Vestra", "Volatol", "Striekforce"
5975 }
5976 --==================================================================================================================================================--
5977 SUVs = {
5978 "BJXL", "Baller", "Baller2", "Baller3", "Baller4", "Baller5", "Baller6", "Cavalcade", "Cavalcade2", "Dubsta", "Dubsta2", "Dubsta3",
5979 "FQ2", "Granger", "Gresley", "Habanero", "Huntley", "Landstalker", "patriot", "Patriot2", "Radi", "Rocoto", "Seminole", "Serrano",
5980 "Toros", "XLS", "XLS2"
5981 }
5982 --==================================================================================================================================================--
5983 Sedans = {
5984 "Asea", "Asea2", "Asterope", "Cog55", "Cogg552", "Cognoscenti", "Cognoscenti2", "emperor", "emperor2", "emperor3", "Fugitive",
5985 "Glendale", "ingot", "intruder", "limo2", "premier", "primo", "primo2", "regina", "romero", "stafford", "Stanier", "stratum", "stretch",
5986 "surge", "tailgater", "warrener", "Washington"
5987 }
5988 --==================================================================================================================================================--
5989 Service = {"Airbus", "Brickade", "Bus", "Coach", "Rallytruck", "Rentalbus", "Taxi", "Tourbus", "Trash", "Trash2", "WastIndr", "PBus2"}
5990 --==================================================================================================================================================--
5991 Sports = {
5992 "Alpha", "Banshee", "Banshee2", "BestiaGTS", "Buffalo", "Buffalo2", "Buffalo3", "Carbonizzare", "Comet2", "Comet3", "Comet4", "Comet5",
5993 "Coquette", "Deveste", "Elegy", "Elegy2", "Feltzer2", "Feltzer3", "FlashGT", "Furoregt", "Fusilade", "Futo", "GB200", "Hotring",
5994 "Infernus2", "Italigto", "Jester", "Jester2", "Khamelion", "Kurama", "Kurama2", "Lynx", "MAssacro", "MAssacro2", "neon", "Ninef",
5995 "ninfe2", "omnis", "Pariah", "Penumbra", "Raiden", "RapidGT", "RapidGT2", "Raptor", "Revolter", "Ruston", "Schafter2", "Schafter3",
5996 "Schafter4", "Schafter5", "Schafter6", "Schlagen", "Schwarzer", "Sentinel3", "Seven70", "Specter", "Specter2", "Streiter", "Sultan",
5997 "Surano", "Tampa2", "Tropos", "Verlierer2", "ZR380", "ZR3802", "ZR3803"
5998 }
5999 --==================================================================================================================================================--
6000 SportsClassic = {
6001 "Ardent", "BType", "BType2", "BType3", "Casco", "Cheetah2", "Cheburek", "Coquette2", "Coquette3", "Deluxo", "Fagaloa", "Gt500", "JB700",
6002 "JEster3", "MAmba", "Manana", "Michelli", "Monroe", "Peyote", "Pigalle", "RapidGT3", "Retinue", "Savastra", "Stinger", "Stingergt",
6003 "Stromberg", "Swinger", "Torero", "Tornado", "Tornado2", "Tornado3", "Tornado4", "Tornado5", "Tornado6", "Viseris", "Z190", "ZType"
6004 }
6005 --==================================================================================================================================================--
6006 Super = {
6007 "adder", "Autarch", "Bullet", "Cheetah", "Cyclone", "EntityXF", "Entity2", "FMJ", "GP1", "Infernus", "LE7B", "Nero", "Nero2", "Osiris",
6008 "Penetrator", "PFister811", "Prototipo", "Reaper", "SC1", "Scramjet", "Sheava", "SultanRS", "Superd", "T20", "Taipan", "Tempesta",
6009 "Tezeract", "Turismo2", "Turismor", "Tyrant", "Tyrus", "Vacca", "Vagner", "Vigilante", "Visione", "Voltic", "Voltic2", "Zentorno",
6010 "Italigtb", "Italigtb2", "XA21"
6011 }
6012 --==================================================================================================================================================--
6013 Trailer = {
6014 "ArmyTanker", "ArmyTrailer", "ArmyTrailer2", "BaleTrailer", "BoatTrailer", "CableCar", "DockTrailer", "Graintrailer", "Proptrailer",
6015 "Raketailer", "TR2", "TR3", "TR4", "TRFlat", "TVTrailer", "Tanker", "Tanker2", "Trailerlogs", "Trailersmall", "Trailers", "Trailers2",
6016 "Trailers3"
6017 }
6018 --==================================================================================================================================================--
6019 Trains = {"Freight", "Freightcar", "Freightcont1", "Freightcont2", "Freightgrain", "Freighttrailer", "TankerCar"}
6020 --==================================================================================================================================================--
6021 Utility = {
6022 "Airtug", "Caddy", "Caddy2", "Caddy3", "Docktug", "Forklift", "Mower", "Ripley", "Sadler", "Scrap", "TowTruck", "Towtruck2", "Tractor",
6023 "Tractor2", "Tractor3", "TrailerLArge2", "Utilitruck", "Utilitruck3", "'Utilitruck2"
6024 }
6025 --==================================================================================================================================================--
6026 Vans = {
6027 "Bison", "Bison2", "Bison3", "BobcatXL", "Boxville", "Boxville2", "Boxville3", "Boxville4", "Boxville5", "Burrito", "Burrito2",
6028 "Burrito3", "Burrito4", "Burrito5", "Camper", "GBurrito", "GBurrito2", "Journey", "minivan", "Minivan2", "Paradise", "pony", "Pony2",
6029 "Rumpo", "Rumpo2", "Rumpo3", "Speedo", "Speedo2", "Speedo4", "Surfer", "Surfer2", "Taco", "Youga", "youga2"
6030 }
6031 --==================================================================================================================================================--
6032end
6033local CarsArray = {
6034 GriefersChoice, Boats, Commercial, Compacts, Coupes, Cycles, Emergency, Helicopters, Industrial, Military, Motorcycles, Muscle, OffRoad,
6035 Planes, SUVs, Sedans, Service, Sports, SportsClassic, Super, Trailer, Trains, Utility, Vans
6036}
6037
6038--==================================================================================================================================================--
6039--[[ Weapons ]]
6040--==================================================================================================================================================--
6041WeaponDescriptions = {
6042 ["weapon_advancedrifle"] = GetLabelText("WTD_RIFLE_ADV"),
6043 ["weapon_appistol"] = GetLabelText("WTD_PIST_AP"),
6044 ["weapon_assaultrifle"] = GetLabelText("WTD_RIFLE_ASL"),
6045 ["weapon_assaultrifle_mk2"] = GetLabelText("WTD_RIFLE_ASL2"),
6046 ["weapon_assaultshotgun"] = GetLabelText("WTD_SG_ASL"),
6047 ["weapon_assaultsmg"] = GetLabelText("WTD_SMG_ASL"),
6048 ["weapon_autoshotgun"] = GetLabelText("WTD_AUTOSHGN"),
6049 ["weapon_bat"] = GetLabelText("WTD_BAT"),
6050 ["weapon_ball"] = GetLabelText("WTD_BALL"),
6051 ["weapon_battleaxe"] = GetLabelText("WTD_BATTLEAXE"),
6052 ["weapon_bottle"] = GetLabelText("WTD_BOTTLE"),
6053 ["weapon_bullpuprifle"] = GetLabelText("WTD_BULLRIFLE"),
6054 ["weapon_bullpuprifle_mk2"] = GetLabelText("WTD_BULLRIFLE2"),
6055 ["weapon_bullpupshotgun"] = GetLabelText("WTD_SG_BLP"),
6056 ["weapon_bzgas"] = GetLabelText("WTD_BZGAS"),
6057 ["weapon_carbinerifle"] = GetLabelText("WTD_RIFLE_CBN"),
6058 ["weapon_carbinerifle_mk2"] = GetLabelText("WTD_RIFLE_CBN2"),
6059 ["weapon_combatmg"] = GetLabelText("WTD_MG_CBT"),
6060 ["weapon_combatmg_mk2"] = GetLabelText("WTD_MG_CBT2"),
6061 ["weapon_combatpdw"] = GetLabelText("WTD_COMBATPDW"),
6062 ["weapon_combatpistol"] = GetLabelText("WTD_PIST_CBT"),
6063 ["weapon_compactlauncher"] = GetLabelText("WTD_CMPGL"),
6064 ["weapon_compactrifle"] = GetLabelText("WTD_CMPRIFLE"),
6065 ["weapon_crowbar"] = GetLabelText("WTD_CROWBAR"),
6066 ["weapon_dagger"] = GetLabelText("WTD_DAGGER"),
6067 ["weapon_dbshotgun"] = GetLabelText("WTD_DBSHGN"),
6068 ["weapon_doubleaction"] = GetLabelText("WTD_REV_DA"),
6069 ["weapon_fireextinguisher"] = GetLabelText("WTD_FIRE"),
6070 ["weapon_firework"] = GetLabelText("WTD_FWRKLNCHR"),
6071 ["weapon_flare"] = GetLabelText("WTD_FLARE"),
6072 ["weapon_flaregun"] = GetLabelText("WTD_FLAREGUN"),
6073 ["weapon_flashlight"] = GetLabelText("WTD_FLASHLIGHT"),
6074 ["weapon_golfclub"] = GetLabelText("WTD_GOLFCLUB"),
6075 ["weapon_grenade"] = GetLabelText("WTD_GNADE"),
6076 ["weapon_grenadelauncher"] = GetLabelText("WTD_GL"),
6077 ["weapon_gusenberg"] = GetLabelText("WTD_GUSENBERG"),
6078 ["weapon_hammer"] = GetLabelText("WTD_HAMMER"),
6079 ["weapon_hatchet"] = GetLabelText("WTD_HATCHET"),
6080 ["weapon_heavypistol"] = GetLabelText("WTD_HEAVYPSTL"),
6081 ["weapon_heavyshotgun"] = GetLabelText("WTD_HVYSHOT"),
6082 ["weapon_heavysniper"] = GetLabelText("WTD_SNIP_HVY"),
6083 ["weapon_heavysniper_mk2"] = GetLabelText("WTD_SNIP_HVY2"),
6084 ["weapon_hominglauncher"] = GetLabelText("WTD_HOMLNCH"),
6085 ["weapon_knife"] = GetLabelText("WTD_KNIFE"),
6086 ["weapon_knuckle"] = GetLabelText("WTD_KNUCKLE"),
6087 ["weapon_machete"] = GetLabelText("WTD_MACHETE"),
6088 ["weapon_machinepistol"] = GetLabelText("WTD_MCHPIST"),
6089 ["weapon_marksmanpistol"] = GetLabelText("WTD_MKPISTOL"),
6090 ["weapon_marksmanrifle"] = GetLabelText("WTD_MKRIFLE"),
6091 ["weapon_marksmanrifle_mk2"] = GetLabelText("WTD_MKRIFLE2"),
6092 ["weapon_mg"] = GetLabelText("WTD_MG"),
6093 ["weapon_microsmg"] = GetLabelText("WTD_SMG_MCR"),
6094 ["weapon_minigun"] = GetLabelText("WTD_MINIGUN"),
6095 ["weapon_minismg"] = GetLabelText("WTD_MINISMG"),
6096 ["weapon_molotov"] = GetLabelText("WTD_MOLOTOV"),
6097 ["weapon_musket"] = GetLabelText("WTD_MUSKET"),
6098 ["weapon_nightstick"] = GetLabelText("WTD_NGTSTK"),
6099 ["weapon_petrolcan"] = GetLabelText("WTD_PETROL"),
6100 ["weapon_pipebomb"] = GetLabelText("WTD_PIPEBOMB"),
6101 ["weapon_pistol"] = GetLabelText("WTD_PIST"),
6102 ["weapon_pistol50"] = GetLabelText("WTD_PIST_50"),
6103 ["weapon_pistol_mk2"] = GetLabelText("WTD_PIST2"),
6104 ["weapon_poolcue"] = GetLabelText("WTD_POOLCUE"),
6105 ["weapon_proxmine"] = GetLabelText("WTD_PRXMINE"),
6106 ["weapon_pumpshotgun"] = GetLabelText("WTD_SG_PMP"),
6107 ["weapon_pumpshotgun_mk2"] = GetLabelText("WTD_SG_PMP2"),
6108 ["weapon_railgun"] = GetLabelText("WTD_RAILGUN"),
6109 ["weapon_revolver"] = GetLabelText("WTD_REVOLVER"),
6110 ["weapon_revolver_mk2"] = GetLabelText("WTD_REVOLVER2"),
6111 ["weapon_rpg"] = GetLabelText("WTD_RPG"),
6112 ["weapon_sawnoffshotgun"] = GetLabelText("WTD_SG_SOF"),
6113 ["weapon_smg"] = GetLabelText("WTD_SMG"),
6114 ["weapon_smg_mk2"] = GetLabelText("WTD_SMG2"),
6115 ["weapon_smokegrenade"] = GetLabelText("WTD_GNADE_SMK"),
6116 ["weapon_sniperrifle"] = GetLabelText("WTD_SNIP_RIF"),
6117 ["weapon_snowball"] = GetLabelText("WTD_SNWBALL"),
6118 ["weapon_snspistol"] = GetLabelText("WTD_SNSPISTOL"),
6119 ["weapon_snspistol_mk2"] = GetLabelText("WTD_SNSPISTOL2"),
6120 ["weapon_specialcarbine"] = GetLabelText("WTD_RIFLE_SCBN"),
6121 ["weapon_specialcarbine_mk2"] = GetLabelText("WTD_SPCARBINE2"),
6122 ["weapon_stickybomb"] = GetLabelText("WTD_GNADE_STK"),
6123 ["weapon_stungun"] = GetLabelText("WTD_STUN"),
6124 ["weapon_switchblade"] = GetLabelText("WTD_SWBLADE"),
6125 ["weapon_unarmed"] = GetLabelText("WTD_UNARMED"),
6126 ["weapon_vintagepistol"] = GetLabelText("WTD_VPISTOL"),
6127 ["weapon_wrench"] = GetLabelText("WTD_WRENCH"),
6128 ["weapon_raypistol"] = GetLabelText("WTD_RAYPISTOL"),
6129 ["weapon_raycarbine"] = GetLabelText("WTD_RAYCARBINE"),
6130 ["weapon_rayminigun"] = GetLabelText("WTD_RAYMINIGUN"),
6131 ["weapon_stone_hatchet"] = GetLabelText("WTD_SHATCHET")
6132}
6133WeaponNames = {
6134 ["weapon_advancedrifle"] = GetLabelText("WT_RIFLE_ADV"),
6135 ["weapon_appistol"] = GetLabelText("WT_PIST_AP"),
6136 ["weapon_assaultrifle"] = GetLabelText("WT_RIFLE_ASL"),
6137 ["weapon_assaultrifle_mk2"] = GetLabelText("WT_RIFLE_ASL2"),
6138 ["weapon_assaultshotgun"] = GetLabelText("WT_SG_ASL"),
6139 ["weapon_assaultsmg"] = GetLabelText("WT_SMG_ASL"),
6140 ["weapon_autoshotgun"] = GetLabelText("WT_AUTOSHGN"),
6141 ["weapon_bat"] = GetLabelText("WT_BAT"),
6142 ["weapon_ball"] = GetLabelText("WT_BALL"),
6143 ["weapon_battleaxe"] = GetLabelText("WT_BATTLEAXE"),
6144 ["weapon_bottle"] = GetLabelText("WT_BOTTLE"),
6145 ["weapon_bullpuprifle"] = GetLabelText("WT_BULLRIFLE"),
6146 ["weapon_bullpuprifle_mk2"] = GetLabelText("WT_BULLRIFLE2"),
6147 ["weapon_bullpupshotgun"] = GetLabelText("WT_SG_BLP"),
6148 ["weapon_bzgas"] = GetLabelText("WT_BZGAS"),
6149 ["weapon_carbinerifle"] = GetLabelText("WT_RIFLE_CBN"),
6150 ["weapon_carbinerifle_mk2"] = GetLabelText("WT_RIFLE_CBN2"),
6151 ["weapon_combatmg"] = GetLabelText("WT_MG_CBT"),
6152 ["weapon_combatmg_mk2"] = GetLabelText("WT_MG_CBT2"),
6153 ["weapon_combatpdw"] = GetLabelText("WT_COMBATPDW"),
6154 ["weapon_combatpistol"] = GetLabelText("WT_PIST_CBT"),
6155 ["weapon_compactlauncher"] = GetLabelText("WT_CMPGL"),
6156 ["weapon_compactrifle"] = GetLabelText("WT_CMPRIFLE"),
6157 ["weapon_crowbar"] = GetLabelText("WT_CROWBAR"),
6158 ["weapon_dagger"] = GetLabelText("WT_DAGGER"),
6159 ["weapon_dbshotgun"] = GetLabelText("WT_DBSHGN"),
6160 ["weapon_doubleaction"] = GetLabelText("WT_REV_DA"),
6161 ["weapon_fireextinguisher"] = GetLabelText("WT_FIRE"),
6162 ["weapon_firework"] = GetLabelText("WT_FWRKLNCHR"),
6163 ["weapon_flare"] = GetLabelText("WT_FLARE"),
6164 ["weapon_flaregun"] = GetLabelText("WT_FLAREGUN"),
6165 ["weapon_flashlight"] = GetLabelText("WT_FLASHLIGHT"),
6166 ["weapon_golfclub"] = GetLabelText("WT_GOLFCLUB"),
6167 ["weapon_grenade"] = GetLabelText("WT_GNADE"),
6168 ["weapon_grenadelauncher"] = GetLabelText("WT_GL"),
6169 ["weapon_gusenberg"] = GetLabelText("WT_GUSENBERG"),
6170 ["weapon_hammer"] = GetLabelText("WT_HAMMER"),
6171 ["weapon_hatchet"] = GetLabelText("WT_HATCHET"),
6172 ["weapon_heavypistol"] = GetLabelText("WT_HEAVYPSTL"),
6173 ["weapon_heavyshotgun"] = GetLabelText("WT_HVYSHOT"),
6174 ["weapon_heavysniper"] = GetLabelText("WT_SNIP_HVY"),
6175 ["weapon_heavysniper_mk2"] = GetLabelText("WT_SNIP_HVY2"),
6176 ["weapon_hominglauncher"] = GetLabelText("WT_HOMLNCH"),
6177 ["weapon_knife"] = GetLabelText("WT_KNIFE"),
6178 ["weapon_knuckle"] = GetLabelText("WT_KNUCKLE"),
6179 ["weapon_machete"] = GetLabelText("WT_MACHETE"),
6180 ["weapon_machinepistol"] = GetLabelText("WT_MCHPIST"),
6181 ["weapon_marksmanpistol"] = GetLabelText("WT_MKPISTOL"),
6182 ["weapon_marksmanrifle"] = GetLabelText("WT_MKRIFLE"),
6183 ["weapon_marksmanrifle_mk2"] = GetLabelText("WT_MKRIFLE2"),
6184 ["weapon_mg"] = GetLabelText("WT_MG"),
6185 ["weapon_microsmg"] = GetLabelText("WT_SMG_MCR"),
6186 ["weapon_minigun"] = GetLabelText("WT_MINIGUN"),
6187 ["weapon_minismg"] = GetLabelText("WT_MINISMG"),
6188 ["weapon_molotov"] = GetLabelText("WT_MOLOTOV"),
6189 ["weapon_musket"] = GetLabelText("WT_MUSKET"),
6190 ["weapon_nightstick"] = GetLabelText("WT_NGTSTK"),
6191 ["weapon_petrolcan"] = GetLabelText("WT_PETROL"),
6192 ["weapon_pipebomb"] = GetLabelText("WT_PIPEBOMB"),
6193 ["weapon_pistol"] = GetLabelText("WT_PIST"),
6194 ["weapon_pistol50"] = GetLabelText("WT_PIST_50"),
6195 ["weapon_pistol_mk2"] = GetLabelText("WT_PIST2"),
6196 ["weapon_poolcue"] = GetLabelText("WT_POOLCUE"),
6197 ["weapon_proxmine"] = GetLabelText("WT_PRXMINE"),
6198 ["weapon_pumpshotgun"] = GetLabelText("WT_SG_PMP"),
6199 ["weapon_pumpshotgun_mk2"] = GetLabelText("WT_SG_PMP2"),
6200 ["weapon_railgun"] = GetLabelText("WT_RAILGUN"),
6201 ["weapon_revolver"] = GetLabelText("WT_REVOLVER"),
6202 ["weapon_revolver_mk2"] = GetLabelText("WT_REVOLVER2"),
6203 ["weapon_rpg"] = GetLabelText("WT_RPG"),
6204 ["weapon_sawnoffshotgun"] = GetLabelText("WT_SG_SOF"),
6205 ["weapon_smg"] = GetLabelText("WT_SMG"),
6206 ["weapon_smg_mk2"] = GetLabelText("WT_SMG2"),
6207 ["weapon_smokegrenade"] = GetLabelText("WT_GNADE_SMK"),
6208 ["weapon_sniperrifle"] = GetLabelText("WT_SNIP_RIF"),
6209 ["weapon_snowball"] = GetLabelText("WT_SNWBALL"),
6210 ["weapon_snspistol"] = GetLabelText("WT_SNSPISTOL"),
6211 ["weapon_snspistol_mk2"] = GetLabelText("WT_SNSPISTOL2"),
6212 ["weapon_specialcarbine"] = GetLabelText("WT_RIFLE_SCBN"),
6213 ["weapon_specialcarbine_mk2"] = GetLabelText("WT_SPCARBINE2"),
6214 ["weapon_stickybomb"] = GetLabelText("WT_GNADE_STK"),
6215 ["weapon_stungun"] = GetLabelText("WT_STUN"),
6216 ["weapon_switchblade"] = GetLabelText("WT_SWBLADE"),
6217 ["weapon_unarmed"] = GetLabelText("WT_UNARMED"),
6218 ["weapon_vintagepistol"] = GetLabelText("WT_VPISTOL"),
6219 ["weapon_wrench"] = GetLabelText("WT_WRENCH"),
6220 ["weapon_raypistol"] = GetLabelText("WT_RAYPISTOL"),
6221 ["weapon_raycarbine"] = GetLabelText("WT_RAYCARBINE"),
6222 ["weapon_rayminigun"] = GetLabelText("WT_RAYMINIGUN"),
6223 ["weapon_stone_hatchet"] = GetLabelText("WT_SHATCHET")
6224}
6225WeaponComponentNames = {
6226 ["COMPONENT_PISTOL_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6227 ["COMPONENT_PISTOL_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6228 ["COMPONENT_PISTOL_VARMOD_LUXE"] = GetLabelText("WCT_VAR_GOLD"),
6229 ["COMPONENT_PISTOL50_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6230 ["COMPONENT_PISTOL50_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6231 ["COMPONENT_PISTOL50_VARMOD_LUXE"] = GetLabelText("WCT_VAR_SIL"),
6232 ["COMPONENT_COMBATPISTOL_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6233 ["COMPONENT_COMBATPISTOL_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6234 ["COMPONENT_COMBATPISTOL_VARMOD_LOWRIDER"] = GetLabelText("WCT_VAR_GOLD"),
6235 ["COMPONENT_APPISTOL_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6236 ["COMPONENT_APPISTOL_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6237 ["COMPONENT_APPISTOL_VARMOD_LUXE"] = GetLabelText("WCT_VAR_METAL"),
6238 ["COMPONENT_SMG_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6239 ["COMPONENT_SMG_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6240 ["COMPONENT_SMG_CLIP_03"] = GetLabelText("WCT_CLIP_DRM"),
6241 ["COMPONENT_AT_SCOPE_MACRO_02"] = GetLabelText("WCT_SCOPE_MAC"),
6242 ["COMPONENT_SMG_VARMOD_LUXE"] = GetLabelText("WCT_VAR_GOLD"),
6243 ["COMPONENT_MICROSMG_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6244 ["COMPONENT_MICROSMG_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6245 ["COMPONENT_AT_SCOPE_MACRO"] = GetLabelText("WCT_SCOPE_MAC"),
6246 ["COMPONENT_MICROSMG_VARMOD_LUXE"] = GetLabelText("WCT_VAR_GOLD"),
6247 ["COMPONENT_ASSAULTSMG_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6248 ["COMPONENT_ASSAULTSMG_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6249 ["COMPONENT_AT_SCOPE_MACRO"] = GetLabelText("WCT_SCOPE_MAC"),
6250 ["COMPONENT_ASSAULTSMG_VARMOD_LOWRIDER"] = GetLabelText("WCT_VAR_GOLD"),
6251 ["COMPONENT_MG_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6252 ["COMPONENT_MG_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6253 ["COMPONENT_AT_SCOPE_SMALL_02"] = GetLabelText("WCT_SCOPE_SML"),
6254 ["COMPONENT_MG_VARMOD_LOWRIDER"] = GetLabelText("WCT_VAR_GOLD"),
6255 ["COMPONENT_COMBATMG_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6256 ["COMPONENT_COMBATMG_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6257 ["COMPONENT_ASSAULTRIFLE_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6258 ["COMPONENT_ASSAULTRIFLE_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6259 ["COMPONENT_ASSAULTRIFLE_CLIP_03"] = GetLabelText("WCT_CLIP_DRM"),
6260 ["COMPONENT_AT_SCOPE_MACRO"] = GetLabelText("WCT_SCOPE_MAC"),
6261 ["COMPONENT_ASSAULTRIFLE_VARMOD_LUXE"] = GetLabelText("WCT_VAR_GOLD"),
6262 ["COMPONENT_CARBINERIFLE_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6263 ["COMPONENT_CARBINERIFLE_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6264 ["COMPONENT_CARBINERIFLE_CLIP_03"] = GetLabelText("WCT_CLIP_DRM"),
6265 ["COMPONENT_CARBINERIFLE_VARMOD_LUXE"] = GetLabelText("WCT_VAR_GOLD"),
6266 ["COMPONENT_ADVANCEDRIFLE_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6267 ["COMPONENT_ADVANCEDRIFLE_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6268 ["COMPONENT_ADVANCEDRIFLE_VARMOD_LUXE"] = GetLabelText("WCT_VAR_METAL"),
6269 ["COMPONENT_ASSAULTSHOTGUN_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6270 ["COMPONENT_ASSAULTSHOTGUN_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6271 ["COMPONENT_SAWNOFFSHOTGUN_VARMOD_LUXE"] = GetLabelText("WCT_VAR_METAL"),
6272 ["COMPONENT_AT_SR_SUPP"] = GetLabelText("WCT_SUPP"),
6273 ["COMPONENT_PUMPSHOTGUN_VARMOD_LOWRIDER"] = GetLabelText("WCT_VAR_GOLD"),
6274 ["COMPONENT_AT_SCOPE_LARGE"] = GetLabelText("WCT_SCOPE_LRG"),
6275 ["COMPONENT_SNIPERRIFLE_VARMOD_LUXE"] = GetLabelText("WCT_VAR_WOOD"),
6276 ["COMPONENT_AT_SCOPE_LARGE"] = GetLabelText("WCT_SCOPE_LRG"),
6277 ["COMPONENT_AT_SCOPE_MACRO"] = GetLabelText("WCT_SCOPE_MAC"),
6278 ["COMPONENT_AT_SCOPE_MACRO_02"] = GetLabelText("WCT_SCOPE_MAC"),
6279 ["COMPONENT_AT_SCOPE_SMALL_02"] = GetLabelText("WCT_SCOPE_SML"),
6280 ["COMPONENT_AT_SCOPE_LARGE"] = GetLabelText("WCT_SCOPE_LRG"),
6281 ["COMPONENT_AT_SR_SUPP"] = GetLabelText("WCT_SUPP"),
6282 ["COMPONENT_ASSAULTRIFLE_MK2_CAMO"] = GetLabelText("WCT_CAMO_1"),
6283 ["COMPONENT_ASSAULTRIFLE_MK2_CAMO_02"] = GetLabelText("WCT_CAMO_2"),
6284 ["COMPONENT_ASSAULTRIFLE_MK2_CAMO_03"] = GetLabelText("WCT_CAMO_3"),
6285 ["COMPONENT_ASSAULTRIFLE_MK2_CAMO_04"] = GetLabelText("WCT_CAMO_4"),
6286 ["COMPONENT_ASSAULTRIFLE_MK2_CAMO_05"] = GetLabelText("WCT_CAMO_5"),
6287 ["COMPONENT_ASSAULTRIFLE_MK2_CAMO_06"] = GetLabelText("WCT_CAMO_6"),
6288 ["COMPONENT_ASSAULTRIFLE_MK2_CAMO_07"] = GetLabelText("WCT_CAMO_7"),
6289 ["COMPONENT_ASSAULTRIFLE_MK2_CAMO_08"] = GetLabelText("WCT_CAMO_8"),
6290 ["COMPONENT_ASSAULTRIFLE_MK2_CAMO_09"] = GetLabelText("WCT_CAMO_9"),
6291 ["COMPONENT_ASSAULTRIFLE_MK2_CAMO_10"] = GetLabelText("WCT_CAMO_10"),
6292 ["COMPONENT_ASSAULTRIFLE_MK2_CAMO_IND_01"] = GetLabelText("WCT_CAMO_IND"),
6293 ["COMPONENT_ASSAULTRIFLE_MK2_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6294 ["COMPONENT_ASSAULTRIFLE_MK2_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6295 ["COMPONENT_ASSAULTRIFLE_MK2_CLIP_ARMORPIERCING"] = GetLabelText("WCT_CLIP_AP"),
6296 ["COMPONENT_ASSAULTRIFLE_MK2_CLIP_FMJ"] = GetLabelText("WCT_CLIP_FMJ"),
6297 ["COMPONENT_ASSAULTRIFLE_MK2_CLIP_INCENDIARY"] = GetLabelText("WCT_CLIP_INC"),
6298 ["COMPONENT_ASSAULTRIFLE_MK2_CLIP_TRACER"] = GetLabelText("WCT_CLIP_TR"),
6299 ["COMPONENT_AT_AR_AFGRIP"] = GetLabelText("WCT_GRIP"),
6300 ["COMPONENT_AT_AR_AFGRIP_02"] = GetLabelText("WCT_GRIP"),
6301 ["COMPONENT_AT_AR_BARREL_01"] = GetLabelText("WCT_BARR"),
6302 ["COMPONENT_AT_AR_BARREL_02"] = GetLabelText("WCT_BARR2"),
6303 ["COMPONENT_AT_AR_FLSH"] = GetLabelText("WCT_FLASH"),
6304 ["COMPONENT_AT_AR_SUPP"] = GetLabelText("WCT_SUPP"),
6305 ["COMPONENT_AT_AR_SUPP_02"] = GetLabelText("WCT_SUPP"),
6306 ["COMPONENT_AT_BP_BARREL_01"] = GetLabelText("WCT_BARR"),
6307 ["COMPONENT_AT_BP_BARREL_02"] = GetLabelText("WCT_BARR2"),
6308 ["COMPONENT_AT_CR_BARREL_01"] = GetLabelText("WCT_BARR"),
6309 ["COMPONENT_AT_CR_BARREL_02"] = GetLabelText("WCT_BARR2"),
6310 ["COMPONENT_AT_MG_BARREL_01"] = GetLabelText("WCT_BARR"),
6311 ["COMPONENT_AT_MG_BARREL_02"] = GetLabelText("WCT_BARR2"),
6312 ["COMPONENT_AT_MRFL_BARREL_01"] = GetLabelText("WCT_BARR"),
6313 ["COMPONENT_AT_MRFL_BARREL_02"] = GetLabelText("WCT_BARR2"),
6314 ["COMPONENT_AT_MUZZLE_01"] = GetLabelText("WCT_MUZZ1"),
6315 ["COMPONENT_AT_MUZZLE_02"] = GetLabelText("WCT_MUZZ2"),
6316 ["COMPONENT_AT_MUZZLE_03"] = GetLabelText("WCT_MUZZ3"),
6317 ["COMPONENT_AT_MUZZLE_04"] = GetLabelText("WCT_MUZZ4"),
6318 ["COMPONENT_AT_MUZZLE_05"] = GetLabelText("WCT_MUZZ5"),
6319 ["COMPONENT_AT_MUZZLE_06"] = GetLabelText("WCT_MUZZ6"),
6320 ["COMPONENT_AT_MUZZLE_07"] = GetLabelText("WCT_MUZZ7"),
6321 ["COMPONENT_AT_MUZZLE_08"] = GetLabelText("WCT_MUZZ"),
6322 ["COMPONENT_AT_MUZZLE_09"] = GetLabelText("WCT_MUZZ9"),
6323 ["COMPONENT_AT_PI_COMP"] = GetLabelText("WCT_COMP"),
6324 ["COMPONENT_AT_PI_COMP_02"] = GetLabelText("WCT_COMP"),
6325 ["COMPONENT_AT_PI_COMP_03"] = GetLabelText("WCT_COMP"),
6326 ["COMPONENT_AT_PI_FLSH"] = GetLabelText("WCT_FLASH"),
6327 ["COMPONENT_AT_PI_FLSH_02"] = GetLabelText("WCT_FLASH"),
6328 ["COMPONENT_AT_PI_FLSH_03"] = GetLabelText("WCT_FLASH"),
6329 ["COMPONENT_AT_PI_RAIL"] = GetLabelText("WCT_SCOPE_PI"),
6330 ["COMPONENT_AT_PI_RAIL_02"] = GetLabelText("WCT_SCOPE_PI"),
6331 ["COMPONENT_AT_PI_SUPP"] = GetLabelText("WCT_SUPP"),
6332 ["COMPONENT_AT_PI_SUPP_02"] = GetLabelText("WCT_SUPP"),
6333 ["COMPONENT_AT_SB_BARREL_01"] = GetLabelText("WCT_BARR"),
6334 ["COMPONENT_AT_SB_BARREL_02"] = GetLabelText("WCT_BARR2"),
6335 ["COMPONENT_AT_SCOPE_LARGE_FIXED_ZOOM"] = GetLabelText("WCT_SCOPE_LRG"),
6336 ["COMPONENT_AT_SCOPE_LARGE_FIXED_ZOOM_MK2"] = GetLabelText("WCT_SCOPE_LRG2"),
6337 ["COMPONENT_AT_SCOPE_LARGE_MK2"] = GetLabelText("WCT_SCOPE_LRG2"),
6338 ["COMPONENT_AT_SCOPE_MACRO_02_MK2"] = GetLabelText("WCT_SCOPE_MAC2"),
6339 ["COMPONENT_AT_SCOPE_MACRO_02_SMG_MK2"] = GetLabelText("WCT_SCOPE_MAC2"),
6340 ["COMPONENT_AT_SCOPE_MACRO_MK2"] = GetLabelText("WCT_SCOPE_MAC2"),
6341 ["COMPONENT_AT_SCOPE_MAX"] = GetLabelText("WCT_SCOPE_MAX"),
6342 ["COMPONENT_AT_SCOPE_MEDIUM"] = GetLabelText("WCT_SCOPE_LRG"),
6343 ["COMPONENT_AT_SCOPE_MEDIUM_MK2"] = GetLabelText("WCT_SCOPE_MED2"),
6344 ["COMPONENT_AT_SCOPE_NV"] = GetLabelText("WCT_SCOPE_NV"),
6345 ["COMPONENT_AT_SCOPE_SMALL"] = GetLabelText("WCT_SCOPE_SML"),
6346 ["COMPONENT_AT_SCOPE_SMALL_MK2"] = GetLabelText("WCT_SCOPE_SML2"),
6347 ["COMPONENT_AT_SCOPE_SMALL_SMG_MK2"] = GetLabelText("WCT_SCOPE_SML2"),
6348 ["COMPONENT_AT_SCOPE_THERMAL"] = GetLabelText("WCT_SCOPE_TH"),
6349 ["COMPONENT_AT_SC_BARREL_01"] = GetLabelText("WCT_BARR"),
6350 ["COMPONENT_AT_SC_BARREL_02"] = GetLabelText("WCT_BARR2"),
6351 ["COMPONENT_AT_SIGHTS"] = GetLabelText("WCT_HOLO"),
6352 ["COMPONENT_AT_SIGHTS_SMG"] = GetLabelText("WCT_HOLO"),
6353 ["COMPONENT_AT_SR_BARREL_01"] = GetLabelText("WCT_BARR"),
6354 ["COMPONENT_AT_SR_BARREL_02"] = GetLabelText("WCT_BARR2"),
6355 ["COMPONENT_AT_SR_SUPP_03"] = GetLabelText("WCT_SUPP"),
6356 ["COMPONENT_BULLPUPRIFLE_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6357 ["COMPONENT_BULLPUPRIFLE_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6358 ["COMPONENT_BULLPUPRIFLE_MK2_CAMO"] = GetLabelText("WCT_CAMO_1"),
6359 ["COMPONENT_BULLPUPRIFLE_MK2_CAMO_02"] = GetLabelText("WCT_CAMO_2"),
6360 ["COMPONENT_BULLPUPRIFLE_MK2_CAMO_03"] = GetLabelText("WCT_CAMO_3"),
6361 ["COMPONENT_BULLPUPRIFLE_MK2_CAMO_04"] = GetLabelText("WCT_CAMO_4"),
6362 ["COMPONENT_BULLPUPRIFLE_MK2_CAMO_05"] = GetLabelText("WCT_CAMO_5"),
6363 ["COMPONENT_BULLPUPRIFLE_MK2_CAMO_06"] = GetLabelText("WCT_CAMO_6"),
6364 ["COMPONENT_BULLPUPRIFLE_MK2_CAMO_07"] = GetLabelText("WCT_CAMO_7"),
6365 ["COMPONENT_BULLPUPRIFLE_MK2_CAMO_08"] = GetLabelText("WCT_CAMO_8"),
6366 ["COMPONENT_BULLPUPRIFLE_MK2_CAMO_09"] = GetLabelText("WCT_CAMO_9"),
6367 ["COMPONENT_BULLPUPRIFLE_MK2_CAMO_10"] = GetLabelText("WCT_CAMO_10"),
6368 ["COMPONENT_BULLPUPRIFLE_MK2_CAMO_IND_01"] = GetLabelText("WCT_CAMO_IND"),
6369 ["COMPONENT_BULLPUPRIFLE_MK2_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6370 ["COMPONENT_BULLPUPRIFLE_MK2_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6371 ["COMPONENT_BULLPUPRIFLE_MK2_CLIP_ARMORPIERCING"] = GetLabelText("WCT_CLIP_AP"),
6372 ["COMPONENT_BULLPUPRIFLE_MK2_CLIP_FMJ"] = GetLabelText("WCT_CLIP_FMJ"),
6373 ["COMPONENT_BULLPUPRIFLE_MK2_CLIP_INCENDIARY"] = GetLabelText("WCT_CLIP_INC"),
6374 ["COMPONENT_BULLPUPRIFLE_MK2_CLIP_TRACER"] = GetLabelText("WCT_CLIP_TR"),
6375 ["COMPONENT_BULLPUPRIFLE_VARMOD_LOW"] = GetLabelText("WCT_VAR_METAL"),
6376 ["COMPONENT_CARBINERIFLE_MK2_CAMO"] = GetLabelText("WCT_CAMO_1"),
6377 ["COMPONENT_CARBINERIFLE_MK2_CAMO_02"] = GetLabelText("WCT_CAMO_2"),
6378 ["COMPONENT_CARBINERIFLE_MK2_CAMO_03"] = GetLabelText("WCT_CAMO_3"),
6379 ["COMPONENT_CARBINERIFLE_MK2_CAMO_04"] = GetLabelText("WCT_CAMO_4"),
6380 ["COMPONENT_CARBINERIFLE_MK2_CAMO_05"] = GetLabelText("WCT_CAMO_5"),
6381 ["COMPONENT_CARBINERIFLE_MK2_CAMO_06"] = GetLabelText("WCT_CAMO_6"),
6382 ["COMPONENT_CARBINERIFLE_MK2_CAMO_07"] = GetLabelText("WCT_CAMO_7"),
6383 ["COMPONENT_CARBINERIFLE_MK2_CAMO_08"] = GetLabelText("WCT_CAMO_8"),
6384 ["COMPONENT_CARBINERIFLE_MK2_CAMO_09"] = GetLabelText("WCT_CAMO_9"),
6385 ["COMPONENT_CARBINERIFLE_MK2_CAMO_10"] = GetLabelText("WCT_CAMO_10"),
6386 ["COMPONENT_CARBINERIFLE_MK2_CAMO_IND_01"] = GetLabelText("WCT_CAMO_IND"),
6387 ["COMPONENT_CARBINERIFLE_MK2_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6388 ["COMPONENT_CARBINERIFLE_MK2_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6389 ["COMPONENT_CARBINERIFLE_MK2_CLIP_ARMORPIERCING"] = GetLabelText("WCT_CLIP_AP"),
6390 ["COMPONENT_CARBINERIFLE_MK2_CLIP_FMJ"] = GetLabelText("WCT_CLIP_FMJ"),
6391 ["COMPONENT_CARBINERIFLE_MK2_CLIP_INCENDIARY"] = GetLabelText("WCT_CLIP_INC"),
6392 ["COMPONENT_CARBINERIFLE_MK2_CLIP_TRACER"] = GetLabelText("WCT_CLIP_TR"),
6393 ["COMPONENT_COMBATMG_MK2_CAMO"] = GetLabelText("WCT_CAMO_1"),
6394 ["COMPONENT_COMBATMG_MK2_CAMO_02"] = GetLabelText("WCT_CAMO_2"),
6395 ["COMPONENT_COMBATMG_MK2_CAMO_03"] = GetLabelText("WCT_CAMO_3"),
6396 ["COMPONENT_COMBATMG_MK2_CAMO_04"] = GetLabelText("WCT_CAMO_4"),
6397 ["COMPONENT_COMBATMG_MK2_CAMO_05"] = GetLabelText("WCT_CAMO_5"),
6398 ["COMPONENT_COMBATMG_MK2_CAMO_06"] = GetLabelText("WCT_CAMO_6"),
6399 ["COMPONENT_COMBATMG_MK2_CAMO_07"] = GetLabelText("WCT_CAMO_7"),
6400 ["COMPONENT_COMBATMG_MK2_CAMO_08"] = GetLabelText("WCT_CAMO_8"),
6401 ["COMPONENT_COMBATMG_MK2_CAMO_09"] = GetLabelText("WCT_CAMO_9"),
6402 ["COMPONENT_COMBATMG_MK2_CAMO_10"] = GetLabelText("WCT_CAMO_10"),
6403 ["COMPONENT_COMBATMG_MK2_CAMO_IND_01"] = GetLabelText("WCT_CAMO_IND"),
6404 ["COMPONENT_COMBATMG_MK2_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6405 ["COMPONENT_COMBATMG_MK2_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6406 ["COMPONENT_COMBATMG_MK2_CLIP_ARMORPIERCING"] = GetLabelText("WCT_CLIP_AP"),
6407 ["COMPONENT_COMBATMG_MK2_CLIP_FMJ"] = GetLabelText("WCT_CLIP_FMJ"),
6408 ["COMPONENT_COMBATMG_MK2_CLIP_INCENDIARY"] = GetLabelText("WCT_CLIP_INC"),
6409 ["COMPONENT_COMBATMG_MK2_CLIP_TRACER"] = GetLabelText("WCT_CLIP_TR"),
6410 ["COMPONENT_COMBATPDW_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6411 ["COMPONENT_COMBATPDW_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6412 ["COMPONENT_COMBATPDW_CLIP_03"] = GetLabelText("WCT_CLIP_DRM"),
6413 ["COMPONENT_COMPACTRIFLE_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6414 ["COMPONENT_COMPACTRIFLE_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6415 ["COMPONENT_COMPACTRIFLE_CLIP_03"] = GetLabelText("WCT_CLIP_DRM"),
6416 ["COMPONENT_GUSENBERG_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6417 ["COMPONENT_GUSENBERG_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6418 ["COMPONENT_HEAVYPISTOL_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6419 ["COMPONENT_HEAVYPISTOL_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6420 ["COMPONENT_HEAVYPISTOL_VARMOD_LUXE"] = GetLabelText("WCT_VAR_WOOD"),
6421 ["COMPONENT_HEAVYSHOTGUN_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6422 ["COMPONENT_HEAVYSHOTGUN_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6423 ["COMPONENT_HEAVYSHOTGUN_CLIP_03"] = GetLabelText("WCT_CLIP_DRM"),
6424 ["COMPONENT_HEAVYSNIPER_MK2_CAMO"] = GetLabelText("WCT_CAMO_1"),
6425 ["COMPONENT_HEAVYSNIPER_MK2_CAMO_02"] = GetLabelText("WCT_CAMO_2"),
6426 ["COMPONENT_HEAVYSNIPER_MK2_CAMO_03"] = GetLabelText("WCT_CAMO_3"),
6427 ["COMPONENT_HEAVYSNIPER_MK2_CAMO_04"] = GetLabelText("WCT_CAMO_4"),
6428 ["COMPONENT_HEAVYSNIPER_MK2_CAMO_05"] = GetLabelText("WCT_CAMO_5"),
6429 ["COMPONENT_HEAVYSNIPER_MK2_CAMO_06"] = GetLabelText("WCT_CAMO_6"),
6430 ["COMPONENT_HEAVYSNIPER_MK2_CAMO_07"] = GetLabelText("WCT_CAMO_7"),
6431 ["COMPONENT_HEAVYSNIPER_MK2_CAMO_08"] = GetLabelText("WCT_CAMO_8"),
6432 ["COMPONENT_HEAVYSNIPER_MK2_CAMO_09"] = GetLabelText("WCT_CAMO_9"),
6433 ["COMPONENT_HEAVYSNIPER_MK2_CAMO_10"] = GetLabelText("WCT_CAMO_10"),
6434 ["COMPONENT_HEAVYSNIPER_MK2_CAMO_IND_01"] = GetLabelText("WCT_CAMO_IND"),
6435 ["COMPONENT_HEAVYSNIPER_MK2_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6436 ["COMPONENT_HEAVYSNIPER_MK2_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6437 ["COMPONENT_HEAVYSNIPER_MK2_CLIP_ARMORPIERCING"] = GetLabelText("WCT_CLIP_AP"),
6438 ["COMPONENT_HEAVYSNIPER_MK2_CLIP_EXPLOSIVE"] = GetLabelText("WCT_CLIP_EX"),
6439 ["COMPONENT_HEAVYSNIPER_MK2_CLIP_FMJ"] = GetLabelText("WCT_CLIP_FMJ"),
6440 ["COMPONENT_HEAVYSNIPER_MK2_CLIP_INCENDIARY"] = GetLabelText("WCT_CLIP_INC"),
6441 ["COMPONENT_KNUCKLE_VARMOD_BALLAS"] = GetLabelText("WCT_KNUCK_BG"),
6442 ["COMPONENT_KNUCKLE_VARMOD_BASE"] = GetLabelText("WCT_KNUCK_01"),
6443 ["COMPONENT_KNUCKLE_VARMOD_DIAMOND"] = GetLabelText("WCT_KNUCK_DMD"),
6444 ["COMPONENT_KNUCKLE_VARMOD_DOLLAR"] = GetLabelText("WCT_KNUCK_DLR"),
6445 ["COMPONENT_KNUCKLE_VARMOD_HATE"] = GetLabelText("WCT_KNUCK_HT"),
6446 ["COMPONENT_KNUCKLE_VARMOD_KING"] = GetLabelText("WCT_KNUCK_SLG"),
6447 ["COMPONENT_KNUCKLE_VARMOD_LOVE"] = GetLabelText("WCT_KNUCK_LV"),
6448 ["COMPONENT_KNUCKLE_VARMOD_PIMP"] = GetLabelText("WCT_KNUCK_02"),
6449 ["COMPONENT_KNUCKLE_VARMOD_PLAYER"] = GetLabelText("WCT_KNUCK_PC"),
6450 ["COMPONENT_KNUCKLE_VARMOD_VAGOS"] = GetLabelText("WCT_KNUCK_VG"),
6451 ["COMPONENT_MACHINEPISTOL_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6452 ["COMPONENT_MACHINEPISTOL_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6453 ["COMPONENT_MACHINEPISTOL_CLIP_03"] = GetLabelText("WCT_CLIP_DRM"),
6454 ["COMPONENT_MARKSMANRIFLE_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6455 ["COMPONENT_MARKSMANRIFLE_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6456 ["COMPONENT_MARKSMANRIFLE_MK2_CAMO"] = GetLabelText("WCT_CAMO_1"),
6457 ["COMPONENT_MARKSMANRIFLE_MK2_CAMO_02"] = GetLabelText("WCT_CAMO_2"),
6458 ["COMPONENT_MARKSMANRIFLE_MK2_CAMO_03"] = GetLabelText("WCT_CAMO_3"),
6459 ["COMPONENT_MARKSMANRIFLE_MK2_CAMO_04"] = GetLabelText("WCT_CAMO_4"),
6460 ["COMPONENT_MARKSMANRIFLE_MK2_CAMO_05"] = GetLabelText("WCT_CAMO_5"),
6461 ["COMPONENT_MARKSMANRIFLE_MK2_CAMO_06"] = GetLabelText("WCT_CAMO_6"),
6462 ["COMPONENT_MARKSMANRIFLE_MK2_CAMO_07"] = GetLabelText("WCT_CAMO_7"),
6463 ["COMPONENT_MARKSMANRIFLE_MK2_CAMO_08"] = GetLabelText("WCT_CAMO_8"),
6464 ["COMPONENT_MARKSMANRIFLE_MK2_CAMO_09"] = GetLabelText("WCT_CAMO_9"),
6465 ["COMPONENT_MARKSMANRIFLE_MK2_CAMO_10"] = GetLabelText("WCT_CAMO_10"),
6466 ["COMPONENT_MARKSMANRIFLE_MK2_CAMO_IND_01"] = GetLabelText("WCT_CAMO_10"),
6467 ["COMPONENT_MARKSMANRIFLE_MK2_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6468 ["COMPONENT_MARKSMANRIFLE_MK2_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6469 ["COMPONENT_MARKSMANRIFLE_MK2_CLIP_ARMORPIERCING"] = GetLabelText("WCT_CLIP_AP"),
6470 ["COMPONENT_MARKSMANRIFLE_MK2_CLIP_FMJ"] = GetLabelText("WCT_CLIP_FMJ"),
6471 ["COMPONENT_MARKSMANRIFLE_MK2_CLIP_INCENDIARY"] = GetLabelText("WCT_CLIP_INC"),
6472 ["COMPONENT_MARKSMANRIFLE_MK2_CLIP_TRACER"] = GetLabelText("WCT_CLIP_TR"),
6473 ["COMPONENT_MARKSMANRIFLE_VARMOD_LUXE"] = GetLabelText("WCT_VAR_GOLD"),
6474 ["COMPONENT_MINISMG_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6475 ["COMPONENT_MINISMG_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6476 ["COMPONENT_PISTOL_MK2_CAMO"] = GetLabelText("WCT_CAMO_1"),
6477 ["COMPONENT_PISTOL_MK2_CAMO_02"] = GetLabelText("WCT_CAMO_2"),
6478 ["COMPONENT_PISTOL_MK2_CAMO_03"] = GetLabelText("WCT_CAMO_3"),
6479 ["COMPONENT_PISTOL_MK2_CAMO_04"] = GetLabelText("WCT_CAMO_4"),
6480 ["COMPONENT_PISTOL_MK2_CAMO_05"] = GetLabelText("WCT_CAMO_5"),
6481 ["COMPONENT_PISTOL_MK2_CAMO_06"] = GetLabelText("WCT_CAMO_6"),
6482 ["COMPONENT_PISTOL_MK2_CAMO_07"] = GetLabelText("WCT_CAMO_7"),
6483 ["COMPONENT_PISTOL_MK2_CAMO_08"] = GetLabelText("WCT_CAMO_8"),
6484 ["COMPONENT_PISTOL_MK2_CAMO_09"] = GetLabelText("WCT_CAMO_9"),
6485 ["COMPONENT_PISTOL_MK2_CAMO_10"] = GetLabelText("WCT_CAMO_10"),
6486 ["COMPONENT_PISTOL_MK2_CAMO_IND_01"] = GetLabelText("WCT_CAMO_IND"),
6487 ["COMPONENT_PISTOL_MK2_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6488 ["COMPONENT_PISTOL_MK2_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6489 ["COMPONENT_PISTOL_MK2_CLIP_FMJ"] = GetLabelText("WCT_CLIP_FMJ"),
6490 ["COMPONENT_PISTOL_MK2_CLIP_HOLLOWPOINT"] = GetLabelText("WCT_CLIP_HP"),
6491 ["COMPONENT_PISTOL_MK2_CLIP_INCENDIARY"] = GetLabelText("WCT_CLIP_INC"),
6492 ["COMPONENT_PISTOL_MK2_CLIP_TRACER"] = GetLabelText("WCT_CLIP_TR"),
6493 ["COMPONENT_PUMPSHOTGUN_MK2_CAMO"] = GetLabelText("WCT_CAMO_1"),
6494 ["COMPONENT_PUMPSHOTGUN_MK2_CAMO_02"] = GetLabelText("WCT_CAMO_2"),
6495 ["COMPONENT_PUMPSHOTGUN_MK2_CAMO_03"] = GetLabelText("WCT_CAMO_3"),
6496 ["COMPONENT_PUMPSHOTGUN_MK2_CAMO_04"] = GetLabelText("WCT_CAMO_4"),
6497 ["COMPONENT_PUMPSHOTGUN_MK2_CAMO_05"] = GetLabelText("WCT_CAMO_5"),
6498 ["COMPONENT_PUMPSHOTGUN_MK2_CAMO_06"] = GetLabelText("WCT_CAMO_6"),
6499 ["COMPONENT_PUMPSHOTGUN_MK2_CAMO_07"] = GetLabelText("WCT_CAMO_7"),
6500 ["COMPONENT_PUMPSHOTGUN_MK2_CAMO_08"] = GetLabelText("WCT_CAMO_8"),
6501 ["COMPONENT_PUMPSHOTGUN_MK2_CAMO_09"] = GetLabelText("WCT_CAMO_9"),
6502 ["COMPONENT_PUMPSHOTGUN_MK2_CAMO_10"] = GetLabelText("WCT_CAMO_10"),
6503 ["COMPONENT_PUMPSHOTGUN_MK2_CAMO_IND_01"] = GetLabelText("WCT_CAMO_IND"),
6504 ["COMPONENT_PUMPSHOTGUN_MK2_CLIP_01"] = GetLabelText("WCT_SHELL"),
6505 ["COMPONENT_PUMPSHOTGUN_MK2_CLIP_ARMORPIERCING"] = GetLabelText("WCT_SHELL_AP"),
6506 ["COMPONENT_PUMPSHOTGUN_MK2_CLIP_EXPLOSIVE"] = GetLabelText("WCT_SHELL_EX"),
6507 ["COMPONENT_PUMPSHOTGUN_MK2_CLIP_HOLLOWPOINT"] = GetLabelText("WCT_SHELL_HP"),
6508 ["COMPONENT_PUMPSHOTGUN_MK2_CLIP_INCENDIARY"] = GetLabelText("WCT_SHELL_INC"),
6509 ["COMPONENT_REVOLVER_MK2_CAMO"] = GetLabelText("WCT_CAMO_1"),
6510 ["COMPONENT_REVOLVER_MK2_CAMO_02"] = GetLabelText("WCT_CAMO_2"),
6511 ["COMPONENT_REVOLVER_MK2_CAMO_03"] = GetLabelText("WCT_CAMO_3"),
6512 ["COMPONENT_REVOLVER_MK2_CAMO_04"] = GetLabelText("WCT_CAMO_4"),
6513 ["COMPONENT_REVOLVER_MK2_CAMO_05"] = GetLabelText("WCT_CAMO_5"),
6514 ["COMPONENT_REVOLVER_MK2_CAMO_06"] = GetLabelText("WCT_CAMO_6"),
6515 ["COMPONENT_REVOLVER_MK2_CAMO_07"] = GetLabelText("WCT_CAMO_7"),
6516 ["COMPONENT_REVOLVER_MK2_CAMO_08"] = GetLabelText("WCT_CAMO_8"),
6517 ["COMPONENT_REVOLVER_MK2_CAMO_09"] = GetLabelText("WCT_CAMO_9"),
6518 ["COMPONENT_REVOLVER_MK2_CAMO_10"] = GetLabelText("WCT_CAMO_10"),
6519 ["COMPONENT_REVOLVER_MK2_CAMO_IND_01"] = GetLabelText("WCT_CAMO_IND"),
6520 ["COMPONENT_REVOLVER_MK2_CLIP_01"] = GetLabelText("WCT_CLIP1_RV"),
6521 ["COMPONENT_REVOLVER_MK2_CLIP_FMJ"] = GetLabelText("WCT_CLIP_FMJ"),
6522 ["COMPONENT_REVOLVER_MK2_CLIP_HOLLOWPOINT"] = GetLabelText("WCT_CLIP_HP"),
6523 ["COMPONENT_REVOLVER_MK2_CLIP_INCENDIARY"] = GetLabelText("WCT_CLIP_INC"),
6524 ["COMPONENT_REVOLVER_MK2_CLIP_TRACER"] = GetLabelText("WCT_CLIP_TR"),
6525 ["COMPONENT_REVOLVER_VARMOD_BOSS"] = GetLabelText("WCT_REV_VARB"),
6526 ["COMPONENT_REVOLVER_VARMOD_GOON"] = GetLabelText("WCT_REV_VARG"),
6527 ["COMPONENT_SMG_MK2_CAMO"] = GetLabelText("WCT_CAMO_1"),
6528 ["COMPONENT_SMG_MK2_CAMO_02"] = GetLabelText("WCT_CAMO_2"),
6529 ["COMPONENT_SMG_MK2_CAMO_03"] = GetLabelText("WCT_CAMO_3"),
6530 ["COMPONENT_SMG_MK2_CAMO_04"] = GetLabelText("WCT_CAMO_4"),
6531 ["COMPONENT_SMG_MK2_CAMO_05"] = GetLabelText("WCT_CAMO_5"),
6532 ["COMPONENT_SMG_MK2_CAMO_06"] = GetLabelText("WCT_CAMO_6"),
6533 ["COMPONENT_SMG_MK2_CAMO_07"] = GetLabelText("WCT_CAMO_7"),
6534 ["COMPONENT_SMG_MK2_CAMO_08"] = GetLabelText("WCT_CAMO_8"),
6535 ["COMPONENT_SMG_MK2_CAMO_09"] = GetLabelText("WCT_CAMO_9"),
6536 ["COMPONENT_SMG_MK2_CAMO_10"] = GetLabelText("WCT_CAMO_10"),
6537 ["COMPONENT_SMG_MK2_CAMO_IND_01"] = GetLabelText("WCT_CAMO_IND"),
6538 ["COMPONENT_SMG_MK2_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6539 ["COMPONENT_SMG_MK2_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6540 ["COMPONENT_SMG_MK2_CLIP_FMJ"] = GetLabelText("WCT_CLIP_FMJ"),
6541 ["COMPONENT_SMG_MK2_CLIP_HOLLOWPOINT"] = GetLabelText("WCT_CLIP_HP"),
6542 ["COMPONENT_SMG_MK2_CLIP_INCENDIARY"] = GetLabelText("WCT_CLIP_INC"),
6543 ["COMPONENT_SMG_MK2_CLIP_TRACER"] = GetLabelText("WCT_CLIP_TR"),
6544 ["COMPONENT_SNSPISTOL_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6545 ["COMPONENT_SNSPISTOL_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6546 ["COMPONENT_SNSPISTOL_MK2_CAMO"] = GetLabelText("WCT_CAMO_1"),
6547 ["COMPONENT_SNSPISTOL_MK2_CAMO_02"] = GetLabelText("WCT_CAMO_2"),
6548 ["COMPONENT_SNSPISTOL_MK2_CAMO_03"] = GetLabelText("WCT_CAMO_3"),
6549 ["COMPONENT_SNSPISTOL_MK2_CAMO_04"] = GetLabelText("WCT_CAMO_4"),
6550 ["COMPONENT_SNSPISTOL_MK2_CAMO_05"] = GetLabelText("WCT_CAMO_5"),
6551 ["COMPONENT_SNSPISTOL_MK2_CAMO_06"] = GetLabelText("WCT_CAMO_6"),
6552 ["COMPONENT_SNSPISTOL_MK2_CAMO_07"] = GetLabelText("WCT_CAMO_7"),
6553 ["COMPONENT_SNSPISTOL_MK2_CAMO_08"] = GetLabelText("WCT_CAMO_8"),
6554 ["COMPONENT_SNSPISTOL_MK2_CAMO_09"] = GetLabelText("WCT_CAMO_9"),
6555 ["COMPONENT_SNSPISTOL_MK2_CAMO_10"] = GetLabelText("WCT_CAMO_10"),
6556 ["COMPONENT_SNSPISTOL_MK2_CAMO_IND_01"] = GetLabelText("WCT_CAMO_10"),
6557 ["COMPONENT_SNSPISTOL_MK2_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6558 ["COMPONENT_SNSPISTOL_MK2_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6559 ["COMPONENT_SNSPISTOL_MK2_CLIP_FMJ"] = GetLabelText("WCT_CLIP_FMJ"),
6560 ["COMPONENT_SNSPISTOL_MK2_CLIP_HOLLOWPOINT"] = GetLabelText("WCT_CLIP_HP"),
6561 ["COMPONENT_SNSPISTOL_MK2_CLIP_INCENDIARY"] = GetLabelText("WCT_CLIP_INC"),
6562 ["COMPONENT_SNSPISTOL_MK2_CLIP_TRACER"] = GetLabelText("WCT_CLIP_TR"),
6563 ["COMPONENT_SNSPISTOL_VARMOD_LOWRIDER"] = GetLabelText("WCT_VAR_WOOD"),
6564 ["COMPONENT_SPECIALCARBINE_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6565 ["COMPONENT_SPECIALCARBINE_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6566 ["COMPONENT_SPECIALCARBINE_CLIP_03"] = GetLabelText("WCT_CLIP_DRM"),
6567 ["COMPONENT_SPECIALCARBINE_MK2_CAMO"] = GetLabelText("WCT_CAMO_1"),
6568 ["COMPONENT_SPECIALCARBINE_MK2_CAMO_02"] = GetLabelText("WCT_CAMO_2"),
6569 ["COMPONENT_SPECIALCARBINE_MK2_CAMO_03"] = GetLabelText("WCT_CAMO_3"),
6570 ["COMPONENT_SPECIALCARBINE_MK2_CAMO_04"] = GetLabelText("WCT_CAMO_4"),
6571 ["COMPONENT_SPECIALCARBINE_MK2_CAMO_05"] = GetLabelText("WCT_CAMO_5"),
6572 ["COMPONENT_SPECIALCARBINE_MK2_CAMO_06"] = GetLabelText("WCT_CAMO_6"),
6573 ["COMPONENT_SPECIALCARBINE_MK2_CAMO_07"] = GetLabelText("WCT_CAMO_7"),
6574 ["COMPONENT_SPECIALCARBINE_MK2_CAMO_08"] = GetLabelText("WCT_CAMO_8"),
6575 ["COMPONENT_SPECIALCARBINE_MK2_CAMO_09"] = GetLabelText("WCT_CAMO_9"),
6576 ["COMPONENT_SPECIALCARBINE_MK2_CAMO_10"] = GetLabelText("WCT_CAMO_10"),
6577 ["COMPONENT_SPECIALCARBINE_MK2_CAMO_IND_01"] = GetLabelText("WCT_CAMO_IND"),
6578 ["COMPONENT_SPECIALCARBINE_MK2_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6579 ["COMPONENT_SPECIALCARBINE_MK2_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6580 ["COMPONENT_SPECIALCARBINE_MK2_CLIP_ARMORPIERCING"] = GetLabelText("WCT_CLIP_AP"),
6581 ["COMPONENT_SPECIALCARBINE_MK2_CLIP_FMJ"] = GetLabelText("WCT_CLIP_FMJ"),
6582 ["COMPONENT_SPECIALCARBINE_MK2_CLIP_INCENDIARY"] = GetLabelText("WCT_CLIP_INC"),
6583 ["COMPONENT_SPECIALCARBINE_MK2_CLIP_TRACER"] = GetLabelText("WCT_CLIP_TR"),
6584 ["COMPONENT_SPECIALCARBINE_VARMOD_LOWRIDER"] = GetLabelText("WCT_VAR_ETCHM"),
6585 ["COMPONENT_SWITCHBLADE_VARMOD_BASE"] = GetLabelText("WCT_SB_BASE"),
6586 ["COMPONENT_SWITCHBLADE_VARMOD_VAR1"] = GetLabelText("WCT_SB_VAR1"),
6587 ["COMPONENT_SWITCHBLADE_VARMOD_VAR2"] = GetLabelText("WCT_SB_VAR2"),
6588 ["COMPONENT_VINTAGEPISTOL_CLIP_01"] = GetLabelText("WCT_CLIP1"),
6589 ["COMPONENT_VINTAGEPISTOL_CLIP_02"] = GetLabelText("WCT_CLIP2"),
6590 ["COMPONENT_RAYPISTOL_VARMOD_XMAS18"] = GetLabelText("WCT_VAR_RAY18")
6591}
6592WeaponTints = {
6593 ["Black"] = 0,
6594 ["Green"] = 1,
6595 ["Gold"] = 2,
6596 ["Pink"] = 3,
6597 ["Army"] = 4,
6598 ["LSPD"] = 5,
6599 ["Orange"] = 6,
6600 ["Platinum"] = 7
6601}
6602WeaponTintsMkII = {
6603 ["Classic Black"] = 0,
6604 ["Classic Gray"] = 1,
6605 ["Classic Two Tone"] = 2,
6606 ["Classic White"] = 3,
6607 ["Classic Beige"] = 4,
6608 ["Classic Green"] = 5,
6609 ["Classic Blue"] = 6,
6610 ["Classic Earth"] = 7,
6611 ["Classic Brown & Black"] = 8,
6612 ["Red Contrast"] = 9,
6613 ["Blue Contrast"] = 10,
6614 ["Yellow Contrast"] = 11,
6615 ["Orange Contrast"] = 12,
6616 ["Bold Pink"] = 13,
6617 ["Bold Purple & Yellow"] = 14,
6618 ["Bold Orange"] = 15,
6619 ["Bold Green & Purple"] = 16,
6620 ["Bold Red Features"] = 17,
6621 ["Bold Green Features"] = 18,
6622 ["Bold Cyan Features"] = 19,
6623 ["Bold Yellow Features"] = 20,
6624 ["Bold Red & White"] = 21,
6625 ["Bold Blue & White"] = 22,
6626 ["Metallic Gold"] = 23,
6627 ["Metallic Platinum"] = 24,
6628 ["Metallic Gray & Lilac"] = 25,
6629 ["Metallic Purple & Lime"] = 26,
6630 ["Metallic Red"] = 27,
6631 ["Metallic Green"] = 28,
6632 ["Metallic Blue"] = 29,
6633 ["Metallic White & Aqua"] = 30,
6634 ["Metallic Red & Yellow"] = 31
6635}
6636
6637function CreateWeaponList()
6638 local _weaponsList = {}
6639
6640 for code, name in pairs(WeaponNames) do
6641 local realName = code
6642 local localizedName = name
6643 if (realName ~= "weapon_unarmed") then
6644 local hash = GetHashKey(code)
6645 local componentHashes = {}
6646 for comp, _ in pairs(WeaponComponentNames) do
6647 if (DoesWeaponTakeWeaponComponent(hash, GetHashKey(comp))) then
6648 if not (table.ContainsKey(componentHashes, comp)) then
6649 componentHashes[comp] = GetHashKey(comp);
6650 end
6651 end
6652 end
6653
6654 local validWeapon = {
6655 Hash = hash,
6656 SpawnName = realName,
6657 Name = localizedName,
6658 Components = componentHashes
6659 };
6660
6661 if _weaponsList == nil then table.insert(_weaponsList, validWeapon); end;
6662
6663 if not table.Contains(_weaponsList, validWeapon) then table.insert(_weaponsList, validWeapon); end;
6664 end
6665 end
6666 return _weaponsList;
6667end
6668
6669function SpawnCustomWeapon(PlayerPed)
6670 local ammo = 900;
6671 local inputName = FiveM.GetKeyboardInput("Enter Weapon Model Name", "Pistol", 10);
6672 if not (string.IsNullOrEmpty(inputName)) then
6673 local model = GetHashKey(inputName:upper());
6674
6675 if IsWeaponValid(model) then
6676 GiveWeaponToPed(PlayerPed, model, ammo, false, true);
6677 FiveM.Subtitle("Added weapon to inventory.");
6678 else
6679 FiveM.Notify("This ("..tostring(inputName)..") is not a valid weapon model name, or the model hash ("..tostring(model)..") could not be found in the game files.", NotificationType.Error);
6680 end
6681 else
6682 FiveM.Notify("Invalid Input!", NotificationType.Error);
6683 end
6684end
6685
6686function SpawnWeaponMenu(WeaponSpawnMenu, PlayerPed)
6687 local weaponInfo = {}
6688 local weaponComponents = {}
6689
6690 local spawnWeapon = NativeUI.CreateItem("Spawn Weapon By Name", "Enter a weapon mode name to spawn.")
6691 spawnWeapon:SetLeftBadge(BadgeStyle.Gun);
6692 spawnWeapon.Activated = function(menu, item, index) SpawnCustomWeapon(PlayerPed) end
6693 WeaponSpawnMenu:AddItem(spawnWeapon)
6694
6695 WeaponSpawnMenu:AddSpacerItem("↓ Weapon Categories ↓")
6696
6697 local handGunsMenu = (HoaxMenuPool:AddSubMenu(WeaponSpawnMenu, "Handguns"))
6698 handGunsMenu.Item:RightLabel("→→")
6699 handGunsMenu = handGunsMenu.SubMenu
6700
6701 local riflesMenu = (HoaxMenuPool:AddSubMenu(WeaponSpawnMenu, "Assault Rifles"))
6702 riflesMenu.Item:RightLabel("→→")
6703 riflesMenu = riflesMenu.SubMenu
6704
6705 local shotgunsMenu = (HoaxMenuPool:AddSubMenu(WeaponSpawnMenu, "Shotguns"))
6706 shotgunsMenu.Item:RightLabel("→→")
6707 shotgunsMenu = shotgunsMenu.SubMenu
6708
6709 local smgsMenu = (HoaxMenuPool:AddSubMenu(WeaponSpawnMenu, "Sub-/Light Machine Guns"))
6710 smgsMenu.Item:RightLabel("→→")
6711 smgsMenu = smgsMenu.SubMenu
6712
6713 local throwablesMenu = (HoaxMenuPool:AddSubMenu(WeaponSpawnMenu, "Throwables"))
6714 throwablesMenu.Item:RightLabel("→→")
6715 throwablesMenu = throwablesMenu.SubMenu
6716
6717 local meleeMenu = (HoaxMenuPool:AddSubMenu(WeaponSpawnMenu, "Melee"))
6718 meleeMenu.Item:RightLabel("→→")
6719 meleeMenu = meleeMenu.SubMenu
6720
6721 local heavyMenu = (HoaxMenuPool:AddSubMenu(WeaponSpawnMenu, "Heavy Weapons"))
6722 heavyMenu.Item:RightLabel("→→")
6723 heavyMenu = heavyMenu.SubMenu
6724
6725 local snipersMenu = (HoaxMenuPool:AddSubMenu(WeaponSpawnMenu, "Sniper Rifles"))
6726 snipersMenu.Item:RightLabel("→→")
6727 snipersMenu = snipersMenu.SubMenu
6728
6729 local weaponList = CreateWeaponList();
6730
6731 for key, weapon in pairs(weaponList) do
6732 local cat = GetWeapontypeGroup(weapon.Hash);
6733
6734 if not string.IsNullOrEmpty(weapon.Name) then
6735 local weaponItem = NativeUI.CreateItem(weapon.Name, "Open the options for ~y~"..tostring(weapon.Name).."~s~.")
6736 weaponItem:SetLeftBadge(BadgeStyle.Gun);
6737
6738 local weaponMenu = (HoaxMenuPool:AddSubMenu(WeaponSpawnMenu, "~y~" ..tostring(weapon.Name).."~s~ Options", weapon.Name, "false"))
6739 weaponMenu.Item:RightLabel("→→")
6740 weaponMenu = weaponMenu.SubMenu
6741
6742 weaponInfo[weaponMenu] = weapon;
6743
6744 local getOrRemoveWeapon = NativeUI.CreateItem("Equip/Remove Weapon", "Add or remove this weapon to/form your inventory.")
6745 getOrRemoveWeapon:SetLeftBadge(BadgeStyle.Gun);
6746 weaponMenu:AddItem(getOrRemoveWeapon);
6747
6748 local fillAmmo = NativeUI.CreateItem("Re-fill Ammo", "Get max ammo for this weapon.")
6749 fillAmmo:SetLeftBadge(BadgeStyle.Ammo);
6750 weaponMenu:AddItem(fillAmmo);
6751
6752 local tints = {};
6753 do
6754 if (string.match(weapon.Name, "Mk II")) then
6755 for tint, value in ipairs(WeaponTintsMkII) do
6756 table.insert(tints, tint)
6757 end
6758 else
6759 for tint, value in pairs(WeaponTints) do
6760 table.insert(tints, tint)
6761 end
6762 end
6763 if table.Count(tints) > 0 then
6764 local weaponTints = NativeUI.CreateListItem("Tints", tints, 0, "Select a tint for your weapon.");
6765 weaponMenu:AddItem(weaponTints);
6766 end
6767 end
6768
6769 if (table.Count(weapon.Components) > 0) then
6770 weaponMenu:AddSpacerItem("↓ Weapon Components ↓")
6771 local compItem = nil;
6772 for comp,_ in pairs(weapon.Components) do
6773 compItem = NativeUI.CreateCheckboxItem(WeaponComponentNames[comp], component,"Click to equip or remove this component.");
6774 weaponComponents[compItem] = comp;
6775 weaponMenu:AddItem(compItem);
6776 end
6777 end
6778
6779 weaponMenu.OnListIndexChange = function(sender, item, oldIndex, newIndex, itemIndex)
6780 if (item == weaponTints) then
6781 if (HasPedGotWeapon(PlayerPed, weaponInfo[sender].Hash, false)) then
6782 SetPedWeaponTintIndex(PlayerPed, weaponInfo[sender].Hash, newIndex);
6783 else
6784 FiveM.Notify("You need to get the weapon first!", NotificationType.Error);
6785 end;
6786 end;
6787 end;
6788
6789 weaponMenu.OnCheckboxChange = function(menu, item, enabled)
6790 local Weapon = weaponInfo[menu];
6791 local component = weaponComponents[item];
6792 local componentHash = Weapon.Components[component];
6793
6794 if (HasPedGotWeapon(PlayerPed, Weapon.Hash, false)) then
6795 SetCurrentPedWeapon(PlayerPed, Weapon.Hash, true);
6796 if (HasPedGotWeaponComponent(PlayerPed, Weapon.Hash, componentHash)) then
6797 RemoveWeaponComponentFromPed(PlayerPed, Weapon.Hash, componentHash);
6798 FiveM.Subtitle("Component removed.");
6799 else
6800 local ammo = GetAmmoInPedWeapon(PlayerPed, Weapon.Hash);
6801
6802 local clipAmmo = GetAmmoInClip(PlayerPed, Weapon.Hash);
6803
6804 GiveWeaponComponentToPed(PlayerPed, Weapon.Hash, componentHash);
6805
6806 SetAmmoInClip(PlayerPed, Weapon.Hash, clipAmmo);
6807
6808 SetPedAmmo(PlayerPed, Weapon.Hash, ammo);
6809 FiveM.Subtitle("Component equiped.");
6810 end
6811 else
6812 FiveM.Notify("You need to get the weapon first before you can modify it.", NotificationType.Error);
6813 end
6814 end
6815
6816 weaponMenu.OnItemSelect = function(sender, item, index)
6817 local info = weaponInfo[sender];
6818 local hash = info.Hash;
6819
6820 if (item == getOrRemoveWeapon) then
6821 if (HasPedGotWeapon(PlayerPed, hash, false)) then
6822 RemoveWeaponFromPed(PlayerPed, hash);
6823 FiveM.Subtitle("Weapon removed.");
6824 else
6825 local bool, ammo = GetMaxAmmo(PlayerPed, hash);
6826 GiveWeaponToPed(PlayerPed, hash, ammo, false, true);
6827 FiveM.Subtitle("Weapon added.");
6828 end
6829 elseif (item == fillAmmo) then
6830 if (HasPedGotWeapon(PlayerPed, hash, false)) then
6831 local bool, ammo = GetMaxAmmo(PlayerPed, hash);
6832 SetPedAmmo(PlayerPed, hash, ammo);
6833 else
6834 FiveM.Notify("You need to get the weapon first before re-filling ammo!", NotificationType.Error);
6835 end
6836 end
6837 end
6838
6839 weaponMenu:RefreshIndex();
6840
6841
6842 if cat ~= nil then
6843 if (cat == 970310034) then
6844 riflesMenu:AddItem(weaponItem);
6845 riflesMenu:BindMenuToItem(weaponMenu, weaponItem);
6846
6847 elseif (cat == 416676503 or cat == 690389602) then
6848 handGunsMenu:AddItem(weaponItem);
6849 handGunsMenu:BindMenuToItem(weaponMenu, weaponItem);
6850
6851 elseif (cat == 860033945) then
6852 shotgunsMenu:AddItem(weaponItem);
6853 shotgunsMenu:BindMenuToItem(weaponMenu, weaponItem);
6854
6855 elseif (cat == 3337201093 or cat == 1159398588) then
6856 smgsMenu:AddItem(weaponItem);
6857 smgsMenu:BindMenuToItem(weaponMenu, weaponItem);
6858
6859 elseif (cat == 1548507267 or cat == 4257178988 or cat == 1595662460) then
6860 throwablesMenu:AddItem(weaponItem);
6861 throwablesMenu:BindMenuToItem(weaponMenu, weaponItem);
6862
6863 elseif (cat == 3566412244 or cat == 2685387236 or cat == -728555052) then
6864 meleeMenu:AddItem(weaponItem);
6865 meleeMenu:BindMenuToItem(weaponMenu, weaponItem);
6866
6867 elseif (cat == 2725924767 or cat == -1569042529 or cat == 1159398588) then
6868 heavyMenu:AddItem(weaponItem);
6869 heavyMenu:BindMenuToItem(weaponMenu, weaponItem);
6870
6871 elseif (cat == 3082541095 or cat == -1212426201) then
6872 snipersMenu:AddItem(weaponItem);
6873 snipersMenu:BindMenuToItem(weaponMenu, weaponItem);
6874 end
6875 end
6876
6877 if weaponItem:SetParentMenu() ~= nil then
6878 weaponItem:SetParentMenu().OnMenuChanged = function(menu, newmenu, forward)
6879 if forward then
6880 SetCurrentPedWeapon(PlayerPed, weaponInfo[newmenu].Hash, true);
6881 end
6882 end
6883 end
6884 end
6885 end
6886end
6887--==================================================================================================================================================--
6888--[[ FiveM Functions ]]
6889--==================================================================================================================================================--
6890FiveM = {}
6891do
6892 FiveM.Notify = function(text, type)
6893 if type == nil then type = NotificationType.None end
6894 SetNotificationTextEntry("STRING")
6895 if type == NotificationType.Info then
6896 AddTextComponentString("~b~~h~Info~h~~s~: " .. text)
6897 elseif type == NotificationType.Error then
6898 AddTextComponentString("~r~~h~Error~h~~s~: " .. text)
6899 elseif type == NotificationType.Alert then
6900 AddTextComponentString("~y~~h~Alert~h~~s~: " .. text)
6901 elseif type == NotificationType.Success then
6902 AddTextComponentString("~g~~h~Success~h~~s~: " .. text)
6903 else
6904 AddTextComponentString(text)
6905 end
6906 DrawNotification(false, false)
6907 end
6908
6909 FiveM.Subtitle = function(message, duration, drawImmediately)
6910 if duration == nil then duration = 2500 end;
6911 if drawImmediately == nil then drawImmediately = true; end;
6912 ClearPrints()
6913 SetTextEntry_2("STRING");
6914 for i = 1, message:len(), 99 do
6915 AddTextComponentString(string.sub(message, i, i + 99))
6916 end
6917 DrawSubtitleTimed(duration, drawImmediately);
6918 end
6919
6920 FiveM.GetKeyboardInput = function(TextEntry, ExampleText, MaxStringLength)
6921 AddTextEntry("FMMC_KEY_TIP1", TextEntry .. ":")
6922 DisplayOnscreenKeyboard(1, "FMMC_KEY_TIP1", "", ExampleText, "", "", "", MaxStringLength)
6923 local blockinput = true
6924 while UpdateOnscreenKeyboard() ~= 1 and UpdateOnscreenKeyboard() ~= 2 do Citizen.Wait(0) end
6925
6926 if UpdateOnscreenKeyboard() ~= 2 then
6927 local result = GetOnscreenKeyboardResult()
6928 Citizen.Wait(500)
6929 blockinput = false
6930 return result
6931 else
6932 Citizen.Wait(500)
6933 blockinput = false
6934 return nil
6935 end
6936 end
6937
6938 FiveM.GetVehicleProperties = function(vehicle)
6939 local color1, color2 = GetVehicleColours(vehicle)
6940 local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle)
6941 local extras = {}
6942
6943 for id = 0, 12 do
6944 if DoesExtraExist(vehicle, id) then
6945 local state = IsVehicleExtraTurnedOn(vehicle, id) == 1
6946 extras[tostring(id)] = state
6947 end
6948 end
6949
6950 return {
6951 model = GetEntityModel(vehicle),
6952
6953 plate = math.trim(GetVehicleNumberPlateText(vehicle)),
6954 plateIndex = GetVehicleNumberPlateTextIndex(vehicle),
6955
6956 health = GetEntityMaxHealth(vehicle),
6957 dirtLevel = GetVehicleDirtLevel(vehicle),
6958
6959 color1 = color1,
6960 color2 = color2,
6961
6962 pearlescentColor = pearlescentColor,
6963 wheelColor = wheelColor,
6964
6965 wheels = GetVehicleWheelType(vehicle),
6966 windowTint = GetVehicleWindowTint(vehicle),
6967
6968 neonEnabled = {
6969 IsVehicleNeonLightEnabled(vehicle, 0), IsVehicleNeonLightEnabled(vehicle, 1), IsVehicleNeonLightEnabled(vehicle, 2),
6970 IsVehicleNeonLightEnabled(vehicle, 3)
6971 },
6972
6973 extras = extras,
6974
6975 neonColor = table.pack(GetVehicleNeonLightsColour(vehicle)),
6976 tyreSmokeColor = table.pack(GetVehicleTyreSmokeColor(vehicle)),
6977
6978 modSpoilers = GetVehicleMod(vehicle, 0),
6979 modFrontBumper = GetVehicleMod(vehicle, 1),
6980 modRearBumper = GetVehicleMod(vehicle, 2),
6981 modSideSkirt = GetVehicleMod(vehicle, 3),
6982 modExhaust = GetVehicleMod(vehicle, 4),
6983 modFrame = GetVehicleMod(vehicle, 5),
6984 modGrille = GetVehicleMod(vehicle, 6),
6985 modHood = GetVehicleMod(vehicle, 7),
6986 modFender = GetVehicleMod(vehicle, 8),
6987 modRightFender = GetVehicleMod(vehicle, 9),
6988 modRoof = GetVehicleMod(vehicle, 10),
6989
6990 modEngine = GetVehicleMod(vehicle, 11),
6991 modBrakes = GetVehicleMod(vehicle, 12),
6992 modTransmission = GetVehicleMod(vehicle, 13),
6993 modHorns = GetVehicleMod(vehicle, 14),
6994 modSuspension = GetVehicleMod(vehicle, 15),
6995 modArmor = GetVehicleMod(vehicle, 16),
6996
6997 modTurbo = IsToggleModOn(vehicle, 18),
6998 modSmokeEnabled = IsToggleModOn(vehicle, 20),
6999 modXenon = IsToggleModOn(vehicle, 22),
7000
7001 modFrontWheels = GetVehicleMod(vehicle, 23),
7002 modBackWheels = GetVehicleMod(vehicle, 24),
7003
7004 modPlateHolder = GetVehicleMod(vehicle, 25),
7005 modVanityPlate = GetVehicleMod(vehicle, 26),
7006 modTrimA = GetVehicleMod(vehicle, 27),
7007 modOrnaments = GetVehicleMod(vehicle, 28),
7008 modDashboard = GetVehicleMod(vehicle, 29),
7009 modDial = GetVehicleMod(vehicle, 30),
7010 modDoorSpeaker = GetVehicleMod(vehicle, 31),
7011 modSeats = GetVehicleMod(vehicle, 32),
7012 modSteeringWheel = GetVehicleMod(vehicle, 33),
7013 modShifterLeavers = GetVehicleMod(vehicle, 34),
7014 modAPlate = GetVehicleMod(vehicle, 35),
7015 modSpeakers = GetVehicleMod(vehicle, 36),
7016 modTrunk = GetVehicleMod(vehicle, 37),
7017 modHydrolic = GetVehicleMod(vehicle, 38),
7018 modEngineBlock = GetVehicleMod(vehicle, 39),
7019 modAirFilter = GetVehicleMod(vehicle, 40),
7020 modStruts = GetVehicleMod(vehicle, 41),
7021 modArchCover = GetVehicleMod(vehicle, 42),
7022 modAerials = GetVehicleMod(vehicle, 43),
7023 modTrimB = GetVehicleMod(vehicle, 44),
7024 modTank = GetVehicleMod(vehicle, 45),
7025 modWindows = GetVehicleMod(vehicle, 46),
7026 modLivery = GetVehicleLivery(vehicle)
7027 }
7028 end
7029
7030 FiveM.SetVehicleProperties = function(vehicle, props)
7031 SetVehicleModKit(vehicle, 0)
7032
7033 if props.plate ~= nil then SetVehicleNumberPlateText(vehicle, props.plate) end
7034
7035 if props.plateIndex ~= nil then SetVehicleNumberPlateTextIndex(vehicle, props.plateIndex) end
7036
7037 if props.health ~= nil then SetEntityHealth(vehicle, props.health) end
7038
7039 if props.dirtLevel ~= nil then SetVehicleDirtLevel(vehicle, props.dirtLevel) end
7040
7041 if props.color1 ~= nil then
7042 local color1, color2 = GetVehicleColours(vehicle)
7043 SetVehicleColours(vehicle, props.color1, color2)
7044 end
7045
7046 if props.color2 ~= nil then
7047 local color1, color2 = GetVehicleColours(vehicle)
7048 SetVehicleColours(vehicle, color1, props.color2)
7049 end
7050
7051 if props.pearlescentColor ~= nil then
7052 local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle)
7053 SetVehicleExtraColours(vehicle, props.pearlescentColor, wheelColor)
7054 end
7055
7056 if props.wheelColor ~= nil then
7057 local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle)
7058 SetVehicleExtraColours(vehicle, pearlescentColor, props.wheelColor)
7059 end
7060
7061 if props.wheels ~= nil then SetVehicleWheelType(vehicle, props.wheels) end
7062
7063 if props.windowTint ~= nil then SetVehicleWindowTint(vehicle, props.windowTint) end
7064
7065 if props.neonEnabled ~= nil then
7066 SetVehicleNeonLightEnabled(vehicle, 0, props.neonEnabled[1])
7067 SetVehicleNeonLightEnabled(vehicle, 1, props.neonEnabled[2])
7068 SetVehicleNeonLightEnabled(vehicle, 2, props.neonEnabled[3])
7069 SetVehicleNeonLightEnabled(vehicle, 3, props.neonEnabled[4])
7070 end
7071
7072 if props.extras ~= nil then
7073 for id, enabled in pairs(props.extras) do
7074 if enabled then
7075 SetVehicleExtra(vehicle, tonumber(id), 0)
7076 else
7077 SetVehicleExtra(vehicle, tonumber(id), 1)
7078 end
7079 end
7080 end
7081
7082 if props.neonColor ~= nil then SetVehicleNeonLightsColour(vehicle, props.neonColor[1], props.neonColor[2], props.neonColor[3]) end
7083
7084 if props.modSmokeEnabled ~= nil then ToggleVehicleMod(vehicle, 20, true) end
7085
7086 if props.tyreSmokeColor ~= nil then
7087 SetVehicleTyreSmokeColor(vehicle, props.tyreSmokeColor[1], props.tyreSmokeColor[2], props.tyreSmokeColor[3])
7088 end
7089
7090 if props.modSpoilers ~= nil then SetVehicleMod(vehicle, 0, props.modSpoilers, false) end
7091
7092 if props.modFrontBumper ~= nil then SetVehicleMod(vehicle, 1, props.modFrontBumper, false) end
7093
7094 if props.modRearBumper ~= nil then SetVehicleMod(vehicle, 2, props.modRearBumper, false) end
7095
7096 if props.modSideSkirt ~= nil then SetVehicleMod(vehicle, 3, props.modSideSkirt, false) end
7097
7098 if props.modExhaust ~= nil then SetVehicleMod(vehicle, 4, props.modExhaust, false) end
7099
7100 if props.modFrame ~= nil then SetVehicleMod(vehicle, 5, props.modFrame, false) end
7101
7102 if props.modGrille ~= nil then SetVehicleMod(vehicle, 6, props.modGrille, false) end
7103
7104 if props.modHood ~= nil then SetVehicleMod(vehicle, 7, props.modHood, false) end
7105
7106 if props.modFender ~= nil then SetVehicleMod(vehicle, 8, props.modFender, false) end
7107
7108 if props.modRightFender ~= nil then SetVehicleMod(vehicle, 9, props.modRightFender, false) end
7109
7110 if props.modRoof ~= nil then SetVehicleMod(vehicle, 10, props.modRoof, false) end
7111
7112 if props.modEngine ~= nil then SetVehicleMod(vehicle, 11, props.modEngine, false) end
7113
7114 if props.modBrakes ~= nil then SetVehicleMod(vehicle, 12, props.modBrakes, false) end
7115
7116 if props.modTransmission ~= nil then SetVehicleMod(vehicle, 13, props.modTransmission, false) end
7117
7118 if props.modHorns ~= nil then SetVehicleMod(vehicle, 14, props.modHorns, false) end
7119
7120 if props.modSuspension ~= nil then SetVehicleMod(vehicle, 15, props.modSuspension, false) end
7121
7122 if props.modArmor ~= nil then SetVehicleMod(vehicle, 16, props.modArmor, false) end
7123
7124 if props.modTurbo ~= nil then ToggleVehicleMod(vehicle, 18, props.modTurbo) end
7125
7126 if props.modXenon ~= nil then ToggleVehicleMod(vehicle, 22, props.modXenon) end
7127
7128 if props.modFrontWheels ~= nil then SetVehicleMod(vehicle, 23, props.modFrontWheels, false) end
7129
7130 if props.modBackWheels ~= nil then SetVehicleMod(vehicle, 24, props.modBackWheels, false) end
7131
7132 if props.modPlateHolder ~= nil then SetVehicleMod(vehicle, 25, props.modPlateHolder, false) end
7133
7134 if props.modVanityPlate ~= nil then SetVehicleMod(vehicle, 26, props.modVanityPlate, false) end
7135
7136 if props.modTrimA ~= nil then SetVehicleMod(vehicle, 27, props.modTrimA, false) end
7137
7138 if props.modOrnaments ~= nil then SetVehicleMod(vehicle, 28, props.modOrnaments, false) end
7139
7140 if props.modDashboard ~= nil then SetVehicleMod(vehicle, 29, props.modDashboard, false) end
7141
7142 if props.modDial ~= nil then SetVehicleMod(vehicle, 30, props.modDial, false) end
7143
7144 if props.modDoorSpeaker ~= nil then SetVehicleMod(vehicle, 31, props.modDoorSpeaker, false) end
7145
7146 if props.modSeats ~= nil then SetVehicleMod(vehicle, 32, props.modSeats, false) end
7147
7148 if props.modSteeringWheel ~= nil then SetVehicleMod(vehicle, 33, props.modSteeringWheel, false) end
7149
7150 if props.modShifterLeavers ~= nil then SetVehicleMod(vehicle, 34, props.modShifterLeavers, false) end
7151
7152 if props.modAPlate ~= nil then SetVehicleMod(vehicle, 35, props.modAPlate, false) end
7153
7154 if props.modSpeakers ~= nil then SetVehicleMod(vehicle, 36, props.modSpeakers, false) end
7155
7156 if props.modTrunk ~= nil then SetVehicleMod(vehicle, 37, props.modTrunk, false) end
7157
7158 if props.modHydrolic ~= nil then SetVehicleMod(vehicle, 38, props.modHydrolic, false) end
7159
7160 if props.modEngineBlock ~= nil then SetVehicleMod(vehicle, 39, props.modEngineBlock, false) end
7161
7162 if props.modAirFilter ~= nil then SetVehicleMod(vehicle, 40, props.modAirFilter, false) end
7163
7164 if props.modStruts ~= nil then SetVehicleMod(vehicle, 41, props.modStruts, false) end
7165
7166 if props.modArchCover ~= nil then SetVehicleMod(vehicle, 42, props.modArchCover, false) end
7167
7168 if props.modAerials ~= nil then SetVehicleMod(vehicle, 43, props.modAerials, false) end
7169
7170 if props.modTrimB ~= nil then SetVehicleMod(vehicle, 44, props.modTrimB, false) end
7171
7172 if props.modTank ~= nil then SetVehicleMod(vehicle, 45, props.modTank, false) end
7173
7174 if props.modWindows ~= nil then SetVehicleMod(vehicle, 46, props.modWindows, false) end
7175
7176 if props.modLivery ~= nil then
7177 SetVehicleMod(vehicle, 48, props.modLivery, false)
7178 SetVehicleLivery(vehicle, props.modLivery)
7179 end
7180 end
7181
7182 FiveM.DeleteVehicle = function(vehicle)
7183 SetEntityAsMissionEntity(Object, 1, 1)
7184 DeleteEntity(Object)
7185 SetEntityAsMissionEntity(GetVehiclePedIsIn(GetPlayerPed(-1), false), 1, 1)
7186 DeleteEntity(GetVehiclePedIsIn(GetPlayerPed(-1), false))
7187 end
7188
7189 FiveM.DirtyVehicle = function(vehicle) SetVehicleDirtLevel(vehicle, 15.0) end
7190
7191 FiveM.CleanVehicle = function(vehicle) SetVehicleDirtLevel(vehicle, 1.0) end
7192
7193 FiveM.GetPlayers = function()
7194 local players = {}
7195 for i=0, 255, 1 do
7196 local ped = GetPlayerPed(i)
7197 if DoesEntityExist(ped) then
7198 table.insert(players, i)
7199 end
7200 end
7201 return players
7202 end
7203
7204 FiveM.GetClosestPlayer = function(coords)
7205 local players = FiveM.GetPlayers()
7206 local closestDistance = -1
7207 local closestPlayer = -1
7208 local usePlayerPed = false
7209 local playerPed = PlayerPedId()
7210 local playerId = PlayerId()
7211
7212 if coords == nil then
7213 usePlayerPed = true
7214 coords = GetEntityCoords(playerPed)
7215 end
7216
7217 for i=1, #players, 1 do
7218 local target = GetPlayerPed(players[i])
7219
7220 if not usePlayerPed or (usePlayerPed and players[i] ~= playerId) then
7221 local targetCoords = GetEntityCoords(target)
7222 local distance = GetDistanceBetweenCoords(targetCoords, coords.x, coords.y, coords.z, true)
7223
7224 if closestDistance == -1 or closestDistance > distance then
7225 closestPlayer = players[i]
7226 closestDistance = distance
7227 end
7228 end
7229 end
7230
7231 return closestPlayer, closestDistance
7232 end
7233
7234 FiveM.GetWaypoint = function()
7235 local g_Waypoint = nil;
7236 if DoesBlipExist(GetFirstBlipInfoId(8)) then
7237 local blipIterator = GetBlipInfoIdIterator(8)
7238 local blip = GetFirstBlipInfoId(8, blipIterator)
7239 g_Waypoint = Citizen.InvokeNative(0xFA7C7F0AADF25D09, blip, Citizen.ResultAsVector());
7240 end
7241 print(g_Waypoint);
7242 return g_Waypoint;
7243 end
7244
7245 FiveM.GetSafePlayerName = function(name)
7246 if string.IsNullOrEmpty(name) then return "" end;
7247 return name:gsub("%^", "\\^"):gsub("%~", "\\~"):gsub("%<", "«"):gsub("%>", "»");
7248 end
7249
7250 FiveM.SetResourceLocked = function(resource, item)
7251 Citizen.CreateThread(function()
7252 if item ~= nil then local item_type, item_subtype = item(); end
7253
7254 if GetResourceState(resource) == "started" then
7255 if item ~= nil then item:Enabled(true); end;
7256 if item_subtype == "UIMenuItem" then item:SetRightBadge(BadgeStyle.None); end;
7257 else
7258 if item ~= nil then item:Enabled(false); end;
7259 if item_subtype == "UIMenuItem" then item:SetRightBadge(BadgeStyle.Lock); end;
7260 end
7261 end)
7262 end
7263
7264 FiveM.TriggerCustomEvent = function(server, event, ...)
7265 local payload = msgpack.pack({...})
7266 if server then
7267 TriggerServerEventInternal(event, payload, payload:len())
7268 else
7269 TriggerEventInternal(event, payload, payload:len())
7270 end
7271 end
7272end
7273
7274--==================================================================================================================================================--
7275--[[ World Functions ]]
7276--==================================================================================================================================================--
7277NotificationType = {
7278 None = 0,
7279 Info = 1,
7280 Error = 2,
7281 Alert = 3,
7282 Success = 4
7283}
7284do
7285 function DrawText3D(x, y, z, text, r, g, b)
7286 SetDrawOrigin(x, y, z, 0)
7287 SetTextFont(0)
7288 SetTextProportional(0)
7289 SetTextScale(0.0, 0.20)
7290 SetTextColour(r, g, b, 255)
7291 SetTextDropshadow(0, 0, 0, 0, 255)
7292 SetTextEdge(2, 0, 0, 0, 150)
7293 SetTextDropShadow()
7294 SetTextOutline()
7295 SetTextEntry("STRING")
7296 SetTextCentre(1)
7297 AddTextComponentString(text)
7298 DrawText(0.0, 0.0)
7299 ClearDrawOrigin()
7300 end
7301
7302 function ShootPlayer(playerIdx)
7303 local head = GetPedBoneCoords(playerIdx, GetEntityBoneIndexByName(playerIdx, "SKEL_HEAD"), 0.0, 0.0, 0.0)
7304 SetPedShootsAtCoord(GetPlayerPed(-1), head.x, head.y, head.z, true)
7305 end
7306
7307 function SpectatePlayer(playerIdx)
7308 Spectating = not Spectating
7309
7310 local playerPed = GetPlayerPed(-1)
7311 local targetPed = GetPlayerPed(playerIdx)
7312
7313 if (Spectating) then
7314 local targetx, targety, targetz = table.unpack(GetEntityCoords(targetPed, false))
7315 RequestCollisionAtCoord(targetx, targety, targetz)
7316 NetworkSetInSpectatorMode(true, targetPed)
7317 FiveM.Subtitle("Spectating " .. GetPlayerName(playerIdx))
7318 else
7319 local targetx, targety, targetz = table.unpack(GetEntityCoords(targetPed, false))
7320 RequestCollisionAtCoord(targetx, targety, targetz)
7321 NetworkSetInSpectatorMode(false, targetPed)
7322 FiveM.Subtitle("Stopped Spectating " .. GetPlayerName(playerIdx))
7323 end
7324 end
7325
7326 function PlayScenario(scenarioName)
7327 print(scenarioName)
7328 if (_currentScenario == "" or _currentScenario ~= scenarioName) then
7329 _currentScenario = scenarioName
7330 ClearPedTasks(GetPlayerPed(-1))
7331 local canPlay = true
7332 if (IsPedRunning(GetPlayerPed(-1))) then
7333 FiveM.Notify("You can't start a scenario when you are running.")
7334 canPlay = false
7335 elseif (IsEntityDead(GetPlayerPed(-1))) then
7336 FiveM.Notify("You can't start a scenario when you are dead.")
7337 canPlay = false
7338 elseif (IsPlayerInCutscene(GetPlayerPed(-1))) then
7339 FiveM.Notify("You can't start a scenario when you are in a cutscene.")
7340 canPlay = false
7341 elseif (IsPedFalling(GetPlayerPed(-1))) then
7342 FiveM.Notify("You can't start a scenario when you are falling.")
7343 canPlay = false
7344 elseif (IsPedRagdoll(GetPlayerPed(-1))) then
7345 FiveM.Notify("You can't start a scenario when you are currently in a ragdoll state.")
7346 canPlay = false
7347 elseif (not IsPedOnFoot(GetPlayerPed(-1))) then
7348 FiveM.Notify("You must be on foot to start a scenario.")
7349 canPlay = false
7350 elseif (NetworkIsInSpectatorMode()) then
7351 FiveM.Notify("You can't start a scenario when you are currently spectating..")
7352 canPlay = false
7353 elseif (GetEntitySpeed(GetPlayerPed(-1)) > 5.0) then
7354 FiveM.Notify("You can't start a scenario when you are moving too fast.")
7355 canPlay = false
7356 end
7357
7358 if (canPlay) then
7359 if (table.Contains(PedScenarios.PositionBasedScenarios, scenarioName)) then
7360 local pos = GetOffsetFromEntityInWorldCoords(GetPlayerPed(-1), 0, -0.5, -0.5)
7361 local heading = GetEntityHeading(GetPlayerPed(-1))
7362 TaskStartScenarioAtPosition(GetPlayerPed(-1), scenarioName, pos.X, pos.Y, pos.Z, heading, -1, true, false)
7363 else
7364 TaskStartScenarioInPlace(GetPlayerPed(-1), scenarioName, 0, true)
7365 end
7366 end
7367 else
7368 _currentScenario = ""
7369 ClearPedTasks(GetPlayerPed(-1))
7370 ClearPedSecondaryTask(GetPlayerPed(-1))
7371 end
7372
7373 if (scenarioName == "forcestop") then
7374 _currentScenario = ""
7375 ClearPedTasks(GetPlayerPed(-1))
7376 ClearPedTasksImmediately(GetPlayerPed(-1))
7377 end
7378 end
7379end
7380
7381--==================================================================================================================================================--
7382--[[ ESX Functions ]]
7383--==================================================================================================================================================--
7384ESX = nil
7385do
7386 Citizen.CreateThread(function()
7387 if GetResourceState('es_extended') == "started" then
7388 while ESX == nil and ShowMenu do
7389 TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end);
7390 Citizen.Wait(0)
7391 end
7392 end
7393 end)
7394
7395 function SetPlayerJob(playerIdx, job, level, hire)
7396 local xPlayer = {}
7397 if ESX ~= nil then
7398 ESX.TriggerServerCallback('esx_society:getOnlinePlayers', function(players)
7399 for i = 1, #players do
7400 local name = players[i].name
7401
7402 if name == GetPlayerName(playerIdx) then xPlayer = players[i] end
7403 end
7404
7405 ESX.TriggerServerCallback('esx_society:setJob', function() end, xPlayer.identifier, job, level, hire and 'hire' or 'fire')
7406
7407 if isRiverCityRp then
7408 ESX.TriggerServerCallback('esx:setJob', function() end, xPlayer.identifier, job, level, hire and 'hire' or 'fire')
7409 end
7410 end)
7411 end
7412 end
7413end
7414
7415--==================================================================================================================================================--
7416--[[ Teleport Functions ]]
7417--==================================================================================================================================================--
7418do
7419 function TeleportToPlayer(playerIdx)
7420 local entity = IsPedInAnyVehicle(PlayerPedId(), false) and GetVehiclePedIsUsing(PlayerPedId()) or PlayerPedId()
7421 SetEntityCoords(entity, GetEntityCoords(GetPlayerPed(playerIdx)), 0.0, 0.0, 0.0, false)
7422
7423 entity = IsPedInAnyVehicle(GetPlayerPed(playerIdx), false) and GetVehiclePedIsUsing(GetPlayerPed(playerIdx)) or GetPlayerPed(playerIdx)
7424 SetEntityCoords(entity, GetEntityCoords(GetPlayerPed(-1)), 0.0, 0.0, 0.0, false)
7425 end
7426
7427 FiveM.TeleportToCoords = function (coordinate)
7428 local playerPed = PlayerPedId();
7429 local entity = nil;
7430
7431 local inVehicle = IsPedInAnyVehicle(playerPed, 0) and (GetPedInVehicleSeat(GetVehiclePedIsIn(GetPlayerPed(-1), 0), -1) == playerPed);
7432
7433 if inVehicle then entity = GetVehiclePedIsIn(GetPlayerPed(-1), 0);
7434 else entity = playerPed end
7435
7436 if not inVehicle then ClearPedTasksImmediately(playerPed); end;
7437
7438 if (IsEntityVisible(entity)) then SetEntityVisible(entity, false, 0); NetworkFadeOutEntity(entity, true, false); end
7439
7440 Wait(10); FreezeEntityPosition(entity, true);
7441
7442 DoScreenFadeOut(250);
7443
7444 Wait(10);
7445
7446 local groundZ = 0.0
7447 local zHeight = 1000.0
7448 local bool = false
7449
7450 while ShowMenu do
7451 Wait(10);
7452
7453 if inVehicle then entity = GetVehiclePedIsIn(GetPlayerPed(-1), 0)
7454 else entity = GetPlayerPed(-1) end;
7455
7456 SetEntityCoords(entity, coordinate.x, coordinate.y, zHeight)
7457 FreezeEntityPosition(entity, true)
7458
7459 local entityPos = GetEntityCoords(entity, true)
7460 if groundZ == 0.0 then
7461 zHeight = zHeight - 25.0
7462 SetEntityCoords(entity, entityPos.x, entityPos.y, zHeight)
7463 bool, groundZ = GetGroundZFor_3dCoord(entityPos.x, entityPos.y, entityPos.z, 0)
7464 else
7465 SetEntityCoords(entity, entityPos.x, entityPos.y, groundZ)
7466 FreezeEntityPosition(entity, false)
7467 break
7468 end
7469 end
7470
7471 if inVehicle then
7472 FreezeEntityPosition(entity, false)
7473 SetVehicleOnGroundProperly(entity);
7474 FreezeEntityPosition(entity, true)
7475 end
7476
7477 FreezeEntityPosition(entity, false);
7478 NetworkFadeInEntity(entity, true);
7479
7480 Wait(10); SetEntityVisible(entity, true, 0);
7481
7482 DoScreenFadeIn(250);
7483 SetGameplayCamRelativePitch(0.0, 1.0);
7484 FiveM.Subtitle("~y~Teleported to waypoint!")
7485 end
7486end
7487
7488--==================================================================================================================================================--
7489--[[ Vehicle Functions ]]
7490--==================================================================================================================================================--
7491VehicleMaxSpeeds = { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220 }
7492
7493do
7494 function ParkVehicle(vehicle)
7495 local playerPed = GetPlayerPed(-1)
7496 local playerCoords = GetEntityCoords(playerPed, false)
7497 local x, y, z = table.unpack(playerCoords)
7498 local node, outPos = GetNthClosestVehicleNode(x, y, z, 20, 0, 0, 0)
7499 local sx, sy, sz = table.unpack(outPos)
7500 if node then
7501 FiveM.Notify(NotificationType.Info,
7502 "The player ped will find a suitable place to park the car and will then stop driving. Please wait.")
7503 ClearPedTasks(playerPed)
7504 TaskVehiclePark(playerPed, vehicle, sx, sy, sz, 0, 5, 20, false)
7505 SetVehicleHalt(vehicle, 5, 0, false)
7506 ClearPedTasks(playerPed)
7507 FiveM.Notify(NotificationType.Info, "The player ped has stopped driving and parked the vehicle.")
7508 end
7509 end
7510
7511 function DriveToWaypoint(style)
7512 if style == nil then style = 0 end
7513 local WaypointCoords = nil
7514
7515 if DoesBlipExist(GetFirstBlipInfoId(8)) then
7516 local blipIterator = GetBlipInfoIdIterator(8)
7517 local blip = GetFirstBlipInfoId(8, blipIterator)
7518 WaypointCoords = Citizen.InvokeNative(0xFA7C7F0AADF25D09, blip, Citizen.ResultAsVector())
7519 else
7520 FiveM.Notify("~r~No waypoint!", NotificationType.Error)
7521 end
7522 if WaypointCoords ~= nil then
7523 ClearPedTasks(GetPlayerPed(-1))
7524 DriveWanderTaskActive = false
7525 DriveToWpTaskActive = true
7526
7527 local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false)
7528 local vehicleEntity = GetEntityModel(vehicle)
7529
7530 SetDriverAbility(GetPlayerPed(-1), 1)
7531 SetDriverAggressiveness(GetPlayerPed(-1), 0)
7532
7533 if GetVehicleModelMaxSpeed ~= nil then
7534 TaskVehicleDriveToCoordLongrange(GetPlayerPed(-1), vehicle, WaypointCoords, GetVehicleModelMaxSpeed(vehicleEntity), style, 10)
7535 else
7536 TaskVehicleDriveToCoordLongrange(GetPlayerPed(-1), vehicle, WaypointCoords, Citizen.InvokeNative(0xF417C2502FFFED43, vehicleEntity), style, 10)
7537 end
7538 Citizen.CreateThread(function()
7539 while DriveToWpTaskActive and GetDistanceBetweenCoords(WaypointCoords, GetEntityCoords(vehicle), false) > 15 do
7540 if GetDistanceBetweenCoords(WaypointCoords, GetEntityCoords(vehicle) , false) < 15 then
7541 ParkVehicle(vehicle)
7542 end
7543 Wait(0)
7544 end
7545 end)
7546 else
7547 FiveM.Notify("~r~Waypoint missing!", NotificationType.Error)
7548 end
7549 end
7550
7551 function DriveWander(style)
7552 if style == nil then style = 0 end
7553
7554 ClearPedTasks(GetPlayerPed(-1))
7555 DriveWanderTaskActive = true
7556 DriveToWpTaskActive = false
7557
7558 local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), 0)
7559 local vehicleEntity = GetEntityModel(vehicle)
7560
7561 SetDriverAbility(GetPlayerPed(-1), 1)
7562 SetDriverAggressiveness(GetPlayerPed(-1), 0)
7563 SetEntityMaxSpeed(vehicle, 16.5)
7564
7565 if GetVehicleModelMaxSpeed ~= nil then
7566 TaskVehicleDriveWander(GetPlayerPed(-1), vehicle, GetVehicleModelMaxSpeed(vehicleEntity), style)
7567 else
7568 TaskVehicleDriveWander(GetPlayerPed(-1), vehicle, Citizen.InvokeNative(0xF417C2502FFFED43, vehicleEntity), style)
7569 end
7570 end
7571
7572 function SpawnVehicleToPlayer(modelName, playerIdx)
7573 if modelName and IsModelValid(modelName) and IsModelAVehicle(modelName) then
7574 RequestModel(modelName)
7575 while not HasModelLoaded(modelName) do Citizen.Wait(0) end
7576 local model = (type(modelName) == 'number' and modelName or GetHashKey(modelName))
7577 local playerPed = GetPlayerPed(playerIdx)
7578 local SpawnedVehicle = CreateVehicle(model, GetEntityCoords(playerPed), GetEntityHeading(playerPed), true, true)
7579 local SpawnedVehicleIdx = NetworkGetNetworkIdFromEntity(SpawnedVehicle)
7580 SetNetworkIdCanMigrate(SpawnedVehicleIdx, true)
7581 SetEntityAsMissionEntity(SpawnedVehicle, true, false)
7582 SetVehicleHasBeenOwnedByPlayer(SpawnedVehicle, true)
7583 SetVehicleNeedsToBeHotwired(SpawnedVehicle, false)
7584 SetModelAsNoLongerNeeded(model)
7585
7586 SetPedIntoVehicle(playerPed, SpawnedVehicle, -1)
7587 SetVehicleEngineOn(SpawnedVehicle, true, false, false)
7588 SetVehRadioStation(SpawnedVehicle, 'OFF')
7589 return SpawnedVehicle
7590 else
7591 FiveM.Notify("Invalid Vehicle Model!", NotificationType.Error)
7592 return nil
7593 end
7594 end
7595
7596 function SpawnLegalVehicle(vehicalModelName, playerIdx, plateNumber)
7597 local SpawnedVehicle = SpawnVehicleToPlayer(vehicalModelName, playerIdx)
7598 if SpawnedVehicle ~= nil then
7599 if string.IsNullOrEmpty(plateNumber) then SetVehicleNumberPlateText(SpawnedVehicle, GetVehicleNumberPlateText(SpawnedVehicle))
7600 else SetVehicleNumberPlateText(SpawnedVehicle, plateNumber) end
7601 FiveM.Notify("Spawned Vehicle", NotificationType.Success)
7602 local SpawnedVehicleProperties = FiveM.GetVehicleProperties(SpawnedVehicle)
7603 local SpawnedVehicleModel = GetDisplayNameFromVehicleModel(SpawnedVehicleProperties.model)
7604 if SpawnedVehicleProperties then
7605 FiveM.TriggerCustomEvent(true, 'esx_vehicleshop:setVehicleOwnedPlayerId', GetPlayerServerId(playerIdx), SpawnedVehicleProperties, SpawnedVehicleModel, vehicalModelName, false)
7606 FiveM.Notify("~g~~h~You own this spawned vehicle!")
7607 end
7608 end
7609 end
7610
7611 function MaxTuneVehicle(playerPed)
7612 local vehicle = GetVehiclePedIsIn(playerPed, false)
7613 local vehicleProps = FiveM.GetVehicleProperties(SpawnedVehicle)
7614 SetVehicleModKit(vehicle, 0)
7615 SetVehicleWheelType(vehicle, 7)
7616 for index = 0, 38 do
7617 if index > 16 and index < 23 then
7618 ToggleVehicleMod(vehicle, index, true)
7619 elseif index == 14 then
7620 SetVehicleMod(vehicle, 14, 16, false)
7621 elseif index == 23 or index == 24 then
7622 SetVehicleMod(vehicle, index, 1, false)
7623 else
7624 SetVehicleMod(vehicle, index, GetNumVehicleMods(vehicle, index) - 1, false)
7625 end
7626 end
7627 SetVehicleWindowTint(vehicle, 1)
7628 SetVehicleTyresCanBurst(vehicle, false)
7629 SetVehicleNumberPlateTextIndex(vehicle, 5)
7630 end
7631end
7632
7633--==================================================================================================================================================--
7634--[[ HoaX Menu Functions ]]
7635--==================================================================================================================================================--
7636do
7637 local color = {}
7638 Citizen.CreateThread(function()
7639 while ShowMenu do
7640 Citizen.Wait(0)
7641 color = GenerateRainbow(1.0)
7642 HoaxMenu.Logo:Colour(color.r, color.g, color.b, 255)
7643 end
7644 end)
7645
7646 --[[ Show Blips ]]
7647 Citizen.CreateThread(function()
7648 while ShowMenu do
7649 Citizen.Wait(1)
7650
7651 if ShowMenu and IsPedInAnyVehicle(GetPlayerPed(-1), 0) then
7652 local carModel = "CarName: "..GetDisplayNameFromVehicleModel(GetEntityModel(GetVehiclePedIsIn(GetPlayerPed(-1), 0)))
7653 if carTagId == nil then carTagId = Citizen.InvokeNative(0xBFEFE3321A3F5015, GetPlayerPed(-1), carModel, false, false, "", false) end
7654
7655 if not HasCarTag then
7656 Citizen.InvokeNative(0x63BB75ABEDC1F6A0, carTagId, 0, true)
7657 HasCarTag = true
7658 end
7659 Citizen.CreateThread(function()
7660 if HasCarTag then
7661 Wait(3000)
7662 end
7663 Citizen.InvokeNative(0x63BB75ABEDC1F6A0, carTagId, 0, false)
7664 end)
7665 else
7666 HasCarTag = false
7667 if carTagId ~= nil then
7668 Citizen.InvokeNative(0x63BB75ABEDC1F6A0, carTagId, 0, false)
7669 Citizen.InvokeNative(0x31698AA80E0223F8, carTagId)
7670 carTagId = nil
7671 end
7672 end
7673
7674 for id = 0, 128 do
7675
7676 if NetworkIsPlayerActive(id) and id ~= PlayerId() then
7677
7678 local playerPed = GetPlayerPed(id)
7679 local playerBlip = GetBlipFromEntity(playerPed)
7680 local nameTag = ('[%d] %s'):format(GetPlayerServerId(id), GetPlayerName(id))
7681
7682 -- HEAD DISPLAY STUFF --
7683
7684 -- Create head display (this is safe to be spammed)
7685 local gamerTagId = Citizen.InvokeNative(0xBFEFE3321A3F5015, playerPed, nameTag, false, false, "", false)
7686 local wantedLvl = GetPlayerWantedLevel(id)
7687
7688 if ShowMenu and ShowHeadSprites then
7689 -- Wanted level display
7690 if ShowWantedLevel then
7691 Citizen.InvokeNative(0x63BB75ABEDC1F6A0, gamerTagId, 7, true) -- Add wanted sprite
7692 Citizen.InvokeNative(0xCF228E2AA03099C3, gamerTagId, wantedLvl) -- Set wanted number
7693 else
7694 Citizen.InvokeNative(0x63BB75ABEDC1F6A0, gamerTagId, 7, false) -- Remove wanted sprite
7695 end
7696
7697 Citizen.InvokeNative(0x63BB75ABEDC1F6A0, gamerTagId, 0, true) -- Add player name sprite
7698 Citizen.InvokeNative(0x63BB75ABEDC1F6A0, gamerTagId, 9, NetworkIsPlayerTalking(id)) -- Add / Remove speaking sprite
7699 else
7700 Citizen.InvokeNative(0x63BB75ABEDC1F6A0, gamerTagId, 7, false) -- Remove wanted sprite
7701 Citizen.InvokeNative(0x63BB75ABEDC1F6A0, gamerTagId, 9, false) -- Remove speaking sprite
7702 Citizen.InvokeNative(0x63BB75ABEDC1F6A0, gamerTagId, 0, false) -- Remove player name sprite
7703 Citizen.InvokeNative(0x31698AA80E0223F8, gamerTagId)
7704 end
7705 if ShowMenu and ShowPlayerBlips then
7706 -- BLIP STUFF --
7707
7708 if not DoesBlipExist(playerBlip) then -- Add playerBlip and create head display on player
7709 playerBlip = AddBlipForEntity(playerPed)
7710 SetBlipSprite(playerBlip, 1)
7711 Citizen.InvokeNative(0x5FBCA48327B914DF, playerBlip, true) -- Player Blip indicator
7712
7713 else -- update playerBlip
7714 local vehicle = GetVehiclePedIsIn(playerPed, false)
7715 local blipSprite = GetBlipSprite(playerBlip)
7716
7717 if not GetEntityHealth(playerPed) then -- dead
7718 if blipSprite ~= 274 then
7719 SetBlipSprite(playerBlip, 274)
7720 Citizen.InvokeNative(0x5FBCA48327B914DF, playerBlip, false) -- Player Blip indicator
7721 end
7722
7723 elseif vehicle then
7724 local vehicleClass = GetVehicleClass(vehicle)
7725 local vehicleModel = GetEntityModel(vehicle)
7726
7727 if vehicleClass == 15 then -- jet
7728 if blipSprite ~= 422 then
7729 SetBlipSprite(playerBlip, 422)
7730 Citizen.InvokeNative(0x5FBCA48327B914DF, playerBlip, false) -- Player Blip indicator
7731 end
7732
7733 elseif vehicleClass == 16 then -- plane
7734 if vehicleModel == GetHashKey("besra") or vehicleModel == GetHashKey("hydra") or vehicleModel == GetHashKey("lazer") then -- jet
7735 if blipSprite ~= 424 then
7736 SetBlipSprite(playerBlip, 424)
7737 Citizen.InvokeNative(0x5FBCA48327B914DF, playerBlip, false) -- Player Blip indicator
7738 end
7739
7740 elseif blipSprite ~= 423 then
7741 SetBlipSprite(playerBlip, 423)
7742 Citizen.InvokeNative(0x5FBCA48327B914DF, playerBlip, false) -- Player Blip indicator
7743 end
7744
7745 elseif vehicleClass == 14 then -- boat
7746 if blipSprite ~= 427 then
7747 SetBlipSprite(playerBlip, 427)
7748 Citizen.InvokeNative(0x5FBCA48327B914DF, playerBlip, false) -- Player Blip indicator
7749 end
7750
7751 elseif vehicleModel == GetHashKey("insurgent") or vehicleModel == GetHashKey("insurgent2") or vehicleModel ==
7752 GetHashKey("limo2") then -- insurgent (+ turreted limo cuz limo playerBlip wont work)
7753 if blipSprite ~= 426 then
7754 SetBlipSprite(playerBlip, 426)
7755 Citizen.InvokeNative(0x5FBCA48327B914DF, playerBlip, false) -- Player Blip indicator
7756 end
7757
7758 elseif vehicleModel == GetHashKey("rhino") then -- tank
7759 if blipSprite ~= 421 then
7760 SetBlipSprite(playerBlip, 421)
7761 Citizen.InvokeNative(0x5FBCA48327B914DF, playerBlip, false) -- Player Blip indicator
7762 end
7763
7764 elseif blipSprite ~= 1 then -- default playerBlip
7765 SetBlipSprite(playerBlip, 1)
7766 Citizen.InvokeNative(0x5FBCA48327B914DF, playerBlip, true) -- Player Blip indicator
7767 end
7768
7769 -- Show number in case of passangers
7770 local passengers = GetVehicleNumberOfPassengers(vehicle)
7771
7772 if passengers then
7773 if not IsVehicleSeatFree(vehicle, -1) then passengers = passengers + 1 end
7774 ShowNumberOnBlip(playerBlip, passengers)
7775 else
7776 HideNumberOnBlip(playerBlip)
7777 end
7778 else
7779 -- Remove leftover number
7780 HideNumberOnBlip(playerBlip)
7781 if blipSprite ~= 1 then -- default playerBlip
7782 SetBlipSprite(playerBlip, 1)
7783 Citizen.InvokeNative(0x5FBCA48327B914DF, playerBlip, true) -- Player Blip indicator
7784 end
7785 end
7786
7787 SetBlipRotation(playerBlip, math.ceil(GetEntityHeading(vehicle))) -- update rotation
7788 SetBlipNameToPlayerName(playerBlip, id) -- update playerBlip name
7789 SetBlipScale(playerBlip, 0.85) -- set scale
7790
7791 -- set player alpha
7792 if IsPauseMenuActive() then
7793 SetBlipAlpha(playerBlip, 255)
7794 else
7795 local x1, y1 = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
7796 local x2, y2 = table.unpack(GetEntityCoords(GetPlayerPed(id), true))
7797 local distance = (math.floor(math.abs(math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))) / -1)) + 900
7798 -- Probably a way easier way to do this but whatever im an idiot
7799
7800 if distance < 0 then
7801 distance = 0
7802
7803 elseif distance > 255 then
7804 distance = 255
7805 end
7806
7807 SetBlipAlpha(playerBlip, distance)
7808 end
7809 end
7810 else
7811 RemoveBlip(playerBlip)
7812 end
7813 end
7814 end
7815 end
7816 end)
7817
7818 --[[ World Settings ]]
7819 Citizen.CreateThread(function()
7820 while ShowMenu do
7821 --[[ Display Minimap ]]
7822 DisplayRadar(ShowMenu and ShowRadar)
7823
7824 --[[ Display Extended Minimap ]]
7825 if SetBigmapActive ~= nil then SetBigmapActive(ShowMenu and ShowExtendedRadar, false)
7826 else SetRadarBigmapEnabled(ShowMenu and ShowExtendedRadar, false) end
7827
7828 --[[ Extend minimap on keypress ]]
7829 if IsDisabledControlJustPressed(0, 19) and IsDisabledControlPressed(0, 21) then
7830 ShowExtendedRadar = not ShowExtendedRadar
7831 end
7832
7833 if Enable_SuperJump then SetSuperJumpThisFrame(PlayerId()) end
7834
7835 if Enable_InfiniteStamina then RestorePlayerStamina(PlayerId(), 1.0) end
7836
7837 if ShowCrosshair then ShowHudComponentThisFrame(14) end
7838
7839 if Enable_VehicleGodMode and IsPedInAnyVehicle(GetPlayerPed(-1), true) then
7840 SetEntityInvincible(GetVehiclePedIsUsing(GetPlayerPed(-1)), true)
7841 end
7842
7843 if vehicleFastSpeed_isEnabled and IsPedInAnyVehicle(PlayerPedId(-1), true) then
7844 if IsControlPressed(0, 209) then
7845 SetVehicleForwardSpeed(GetVehiclePedIsUsing(PlayerPedId(-1)), 100.0)
7846 elseif IsControlPressed(0, 210) then
7847 SetVehicleForwardSpeed(GetVehiclePedIsUsing(PlayerPedId(-1)), 0.0)
7848 end
7849 end
7850
7851 if DeleteGun then
7852 local playerEntity = getEntity(PlayerId())
7853 if (IsPedInAnyVehicle(GetPlayerPed(-1), true) == false) then
7854 FiveM.Notify("~g~Delete Gun Enabled!~n~~w~Use The ~b~Pistol~n~~b~Aim ~w~and ~b~Shoot ~w~To Delete!")
7855 GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_PISTOL"), 999999, false, true)
7856 SetPedAmmo(GetPlayerPed(-1), GetHashKey("WEAPON_PISTOL"), 999999)
7857 if (GetSelectedPedWeapon(GetPlayerPed(-1)) == GetHashKey("WEAPON_PISTOL")) then
7858 if IsPlayerFreeAiming(PlayerId()) then
7859 if IsEntityAPed(playerEntity) then
7860 if IsPedInAnyVehicle(playerEntity, true) then
7861 if IsControlJustReleased(1, 142) then
7862 SetEntityAsMissionEntity(GetVehiclePedIsIn(playerEntity, true), 1, 1)
7863 DeleteEntity(GetVehiclePedIsIn(playerEntity, true))
7864 SetEntityAsMissionEntity(playerEntity, 1, 1)
7865 DeleteEntity(playerEntity)
7866 FiveM.Notify("~g~Deleted!")
7867 end
7868 else
7869 if IsControlJustReleased(1, 142) then
7870 SetEntityAsMissionEntity(playerEntity, 1, 1)
7871 DeleteEntity(playerEntity)
7872 FiveM.Notify("~g~Deleted!")
7873 end
7874 end
7875 else
7876 if IsControlJustReleased(1, 142) then
7877 SetEntityAsMissionEntity(playerEntity, 1, 1)
7878 DeleteEntity(playerEntity)
7879 FiveM.Notify("~g~Deleted!")
7880 end
7881 end
7882 end
7883 end
7884 end
7885 end
7886
7887 if empNearbyVehicles then
7888 for vehicle in EnumerateVehicles() do
7889 if (vehicle ~= GetVehiclePedIsIn(GetPlayerPed(-1), false)) then
7890 NetworkRequestControlOfEntity(vehicle)
7891 SetVehicleUndriveable(vehicle, true)
7892 SetVehicleEngineHealth(vehicle, 100)
7893 end
7894 end
7895 end
7896
7897 if deleteNearbyVehicle then
7898 for vehicle in EnumerateVehicles() do
7899 if vehicle ~= GetVehiclePedIsIn(GetPlayerPed(-1), false) then
7900 SetEntityAsMissionEntity(GetVehiclePedIsIn(vehicle, true), 1, 1)
7901 DeleteEntity(GetVehiclePedIsIn(vehicle, true))
7902 SetEntityAsMissionEntity(vehicle, 1, 1)
7903 DeleteEntity(vehicle)
7904 end
7905 end
7906 end
7907
7908 if explodeNearbyVehicles then
7909 for vehicle in EnumerateVehicles() do
7910 if (vehicle ~= GetVehiclePedIsIn(GetPlayerPed(-1), false)) then
7911 NetworkRequestControlOfEntity(vehicle)
7912 NetworkExplodeVehicle(vehicle, true, true, false)
7913 end
7914 end
7915 end
7916
7917 if nameabove then
7918 local ignorePlayerNameDistance = false
7919 local playerNamesDist = 130
7920 for id = 0, 128 do
7921 if NetworkIsPlayerActive(id) and GetPlayerPed(id) ~= GetPlayerPed(-1) then
7922 local ped = GetPlayerPed(id)
7923 local blip = GetBlipFromEntity(ped)
7924
7925 local playerX, playerY, playerZ = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
7926 local targetX, targetY, targetZ = table.unpack(GetEntityCoords(GetPlayerPed(id), true))
7927
7928 local distance = math.floor(GetDistanceBetweenCoords(playerX, playerY, playerZ, targetX, targetY, targetZ, true))
7929
7930 local playerServerIdx = GetPlayerServerId(id)
7931 local playerName = FiveM.GetSafePlayerName(GetPlayerName(id))
7932
7933 if ignorePlayerNameDistance then
7934 if NetworkIsPlayerTalking(id) then
7935 DrawText3D(targetX, targetY, targetZ + 1.2, playerServerIdx .. " | " .. playerName, color.r, color.g, color.b)
7936 else
7937 DrawText3D(targetX, targetY, targetZ + 1.2, playerServerIdx .. " | " .. playerName, 255, 255, 255)
7938 end
7939 end
7940 if distance < playerNamesDist then
7941 if not ignorePlayerNameDistance then
7942 if NetworkIsPlayerTalking(id) then
7943 DrawText3D(targetX, targetY, targetZ + 1.2, playerServerIdx .. " | " .. playerName, color.r, color.g, color.b)
7944 else
7945 DrawText3D(targetX, targetY, targetZ + 1.2, playerServerIdx .. " | " .. playerName, 255, 255, 255)
7946 end
7947 end
7948 end
7949 end
7950 end
7951 end
7952
7953 if ShowEsp then
7954 for i = 0, 128 do
7955 if i ~= PlayerId() and GetPlayerServerId(i) ~= 0 then
7956 local pPed = GetPlayerPed(i)
7957 local cx, cy, cz = table.unpack(GetEntityCoords(PlayerPedId()))
7958 local x, y, z = table.unpack(GetEntityCoords(pPed))
7959 local message = "Name: " .. FiveM.GetSafePlayerName(GetPlayerName(i)) .. "\nServer ID: " .. GetPlayerServerId(i) .. "\nPlayer ID: " .. i ..
7960 "\nDist: " .. math.round(GetDistanceBetweenCoords(cx, cy, cz, x, y, z, true), 1)
7961 if IsPedInAnyVehicle(pPed) then
7962 local VehName = GetLabelText(GetDisplayNameFromVehicleModel(GetEntityModel(GetVehiclePedIsIn(pPed))))
7963 message = message .. "\nVeh: " .. VehName
7964 end
7965 if ShowEspInfo and ShowEsp then DrawText3D(x, y, z + 1.0, message, color.r, color.g, color.b) end
7966 if ShowEspOutline and ShowEsp then
7967 local PedCoords = GetOffsetFromEntityInWorldCoords(pPed)
7968 LineOneBegin = GetOffsetFromEntityInWorldCoords(pPed, -0.3, -0.3, -0.9)
7969 LineOneEnd = GetOffsetFromEntityInWorldCoords(pPed, 0.3, -0.3, -0.9)
7970 LineTwoBegin = GetOffsetFromEntityInWorldCoords(pPed, 0.3, -0.3, -0.9)
7971 LineTwoEnd = GetOffsetFromEntityInWorldCoords(pPed, 0.3, 0.3, -0.9)
7972 LineThreeBegin = GetOffsetFromEntityInWorldCoords(pPed, 0.3, 0.3, -0.9)
7973 LineThreeEnd = GetOffsetFromEntityInWorldCoords(pPed, -0.3, 0.3, -0.9)
7974 LineFourBegin = GetOffsetFromEntityInWorldCoords(pPed, -0.3, -0.3, -0.9)
7975
7976 TLineOneBegin = GetOffsetFromEntityInWorldCoords(pPed, -0.3, -0.3, 0.8)
7977 TLineOneEnd = GetOffsetFromEntityInWorldCoords(pPed, 0.3, -0.3, 0.8)
7978 TLineTwoBegin = GetOffsetFromEntityInWorldCoords(pPed, 0.3, -0.3, 0.8)
7979 TLineTwoEnd = GetOffsetFromEntityInWorldCoords(pPed, 0.3, 0.3, 0.8)
7980 TLineThreeBegin = GetOffsetFromEntityInWorldCoords(pPed, 0.3, 0.3, 0.8)
7981 TLineThreeEnd = GetOffsetFromEntityInWorldCoords(pPed, -0.3, 0.3, 0.8)
7982 TLineFourBegin = GetOffsetFromEntityInWorldCoords(pPed, -0.3, -0.3, 0.8)
7983
7984 ConnectorOneBegin = GetOffsetFromEntityInWorldCoords(pPed, -0.3, 0.3, 0.8)
7985 ConnectorOneEnd = GetOffsetFromEntityInWorldCoords(pPed, -0.3, 0.3, -0.9)
7986 ConnectorTwoBegin = GetOffsetFromEntityInWorldCoords(pPed, 0.3, 0.3, 0.8)
7987 ConnectorTwoEnd = GetOffsetFromEntityInWorldCoords(pPed, 0.3, 0.3, -0.9)
7988 ConnectorThreeBegin = GetOffsetFromEntityInWorldCoords(pPed, -0.3, -0.3, 0.8)
7989 ConnectorThreeEnd = GetOffsetFromEntityInWorldCoords(pPed, -0.3, -0.3, -0.9)
7990 ConnectorFourBegin = GetOffsetFromEntityInWorldCoords(pPed, 0.3, -0.3, 0.8)
7991 ConnectorFourEnd = GetOffsetFromEntityInWorldCoords(pPed, 0.3, -0.3, -0.9)
7992 DrawLine(LineOneBegin.x, LineOneBegin.y, LineOneBegin.z, LineOneEnd.x, LineOneEnd.y, LineOneEnd.z, color.r, color.g, color.b, 255)
7993 DrawLine(LineTwoBegin.x, LineTwoBegin.y, LineTwoBegin.z, LineTwoEnd.x, LineTwoEnd.y, LineTwoEnd.z, color.r, color.g, color.b, 255)
7994 DrawLine(LineThreeBegin.x, LineThreeBegin.y, LineThreeBegin.z, LineThreeEnd.x, LineThreeEnd.y, LineThreeEnd.z, color.r, color.g, color.b, 255)
7995 DrawLine(LineThreeEnd.x, LineThreeEnd.y, LineThreeEnd.z, LineFourBegin.x, LineFourBegin.y, LineFourBegin.z, color.r, color.g, color.b, 255)
7996 DrawLine(TLineOneBegin.x, TLineOneBegin.y, TLineOneBegin.z, TLineOneEnd.x, TLineOneEnd.y, TLineOneEnd.z, color.r, color.g, color.b, 255)
7997 DrawLine(TLineTwoBegin.x, TLineTwoBegin.y, TLineTwoBegin.z, TLineTwoEnd.x, TLineTwoEnd.y, TLineTwoEnd.z, color.r, color.g, color.b, 255)
7998 DrawLine(TLineThreeBegin.x, TLineThreeBegin.y, TLineThreeBegin.z, TLineThreeEnd.x, TLineThreeEnd.y, TLineThreeEnd.z, color.r, color.g, color.b, 255)
7999 DrawLine(TLineThreeEnd.x, TLineThreeEnd.y, TLineThreeEnd.z, TLineFourBegin.x, TLineFourBegin.y, TLineFourBegin.z, color.r, color.g, color.b, 255)
8000 DrawLine(ConnectorOneBegin.x, ConnectorOneBegin.y, ConnectorOneBegin.z, ConnectorOneEnd.x, ConnectorOneEnd.y, ConnectorOneEnd.z, color.r, color.g, color.b, 255)
8001 DrawLine(ConnectorTwoBegin.x, ConnectorTwoBegin.y, ConnectorTwoBegin.z, ConnectorTwoEnd.x, ConnectorTwoEnd.y, ConnectorTwoEnd.z, color.r, color.g, color.b, 255)
8002 DrawLine(ConnectorThreeBegin.x, ConnectorThreeBegin.y, ConnectorThreeBegin.z, ConnectorThreeEnd.x, ConnectorThreeEnd.y, ConnectorThreeEnd.z, color.r, color.g, color.b, 255)
8003 DrawLine(ConnectorFourBegin.x, ConnectorFourBegin.y, ConnectorFourBegin.z, ConnectorFourEnd.x, ConnectorFourEnd.y, ConnectorFourEnd.z, color.r, color.g, color.b, 255)
8004 end
8005 if ShowEspLines and ShowEsp then DrawLine(cx, cy, cz, x, y, z, color.r, color.g, color.b, 255) end
8006 end
8007 end
8008 end
8009
8010 if norecoil then
8011 local weaponTable = {
8012 [453432689] = 1.0,
8013 [3219281620] = 1.0,
8014 [1593441988] = 1.0,
8015 [584646201] = 1.0,
8016 [2578377531] = 1.0,
8017 [324215364] = 1.0,
8018 [736523883] = 1.0,
8019 [2024373456] = 1.0,
8020 [4024951519] = 1.0,
8021 [3220176749] = 1.0,
8022 [961495388] = 1.0,
8023 [2210333304] = 1.0,
8024 [4208062921] = 1.0,
8025 [2937143193] = 1.0,
8026 [2634544996] = 1.0,
8027 [2144741730] = 1.0,
8028 [3686625920] = 1.0,
8029 [487013001] = 1.0,
8030 [1432025498] = 1.0,
8031 [2017895192] = 1.0,
8032 [3800352039] = 1.0,
8033 [2640438543] = 1.0,
8034 [911657153] = 1.0,
8035 [100416529] = 1.0,
8036 [205991906] = 1.0,
8037 [177293209] = 1.0,
8038 [856002082] = 1.0,
8039 [2726580491] = 1.0,
8040 [1305664598] = 1.0,
8041 [2982836145] = 1.0,
8042 [1752584910] = 1.0,
8043 [1119849093] = 1.0,
8044 [3218215474] = 1.0,
8045 [1627465347] = 1.0,
8046 [3231910285] = 1.0,
8047 [-1768145561] = 1.0,
8048 [3523564046] = 1.0,
8049 [2132975508] = 1.0,
8050 [-2066285827] = 1.0,
8051 [137902532] = 1.0,
8052 [2828843422] = 1.0,
8053 [984333226] = 1.0,
8054 [3342088282] = 1.0,
8055 [1785463520] = 1.0,
8056 [1672152130] = 0,
8057 [1198879012] = 1.0,
8058 [171789620] = 1.0,
8059 [3696079510] = 1.0,
8060 [1834241177] = 1.0,
8061 [3675956304] = 1.0,
8062 [3249783761] = 1.0,
8063 [-879347409] = 1.0,
8064 [4019527611] = 1.0,
8065 [1649403952] = 1.0,
8066 [317205821] = 1.0,
8067 [125959754] = 1.0,
8068 [3173288789] = 1.0
8069 }
8070 if IsPedShooting(PlayerPedId(-1)) and not IsPedDoingDriveby(PlayerPedId(-1)) then
8071 local _, cWeapon = GetCurrentPedWeapon(PlayerPedId(-1))
8072 local _, cAmmo = GetAmmoInClip(PlayerPedId(-1), cWeapon)
8073 if weaponTable[cWeapon] and weaponTable[cWeapon] ~= 0 then
8074 local tv = 0
8075 local pitch = 0
8076 if GetFollowPedCamViewMode() ~= 4 then
8077 repeat
8078 Wait(0)
8079 pitch = GetGameplayCamRelativePitch()
8080 SetGameplayCamRelativePitch(pitch + 0.0, 0.0)
8081 tv = tv + 0.0
8082 until tv >= weaponTable[cWeapon]
8083 else
8084 repeat
8085 Wait(0)
8086 pitch = GetGameplayCamRelativePitch()
8087 if weaponTable[cWeapon] > 0.0 then
8088 SetGameplayCamRelativePitch(pitch + 0.0, 0.0)
8089 tv = tv + 0.0
8090 else
8091 SetGameplayCamRelativePitch(pitch + 0.0, 0.0)
8092 tv = tv + 0.0
8093 end
8094 until tv >= weaponTable[cWeapon]
8095 end
8096 end
8097 end
8098 end
8099
8100 if oneshot then
8101 SetPlayerWeaponDamageModifier(PlayerId(), 100.0)
8102 local playerEntity = getEntity(PlayerId())
8103 if IsEntityAPed(playerEntity) then
8104 if IsPedInAnyVehicle(playerEntity, true) then
8105 if IsPedInAnyVehicle(GetPlayerPed(-1), true) then
8106 if IsControlJustReleased(1, 69) then
8107 NetworkExplodeVehicle(GetVehiclePedIsIn(playerEntity, true), true, true, 0)
8108 end
8109 else
8110 if IsControlJustReleased(1, 142) then
8111 NetworkExplodeVehicle(GetVehiclePedIsIn(playerEntity, true), true, true, 0)
8112 end
8113 end
8114 end
8115 elseif IsEntityAVehicle(playerEntity) then
8116 if IsPedInAnyVehicle(GetPlayerPed(-1), true) then
8117 if IsControlJustReleased(1, 69) then NetworkExplodeVehicle(playerEntity, true, true, 0) end
8118 else
8119 if IsControlJustReleased(1, 142) then NetworkExplodeVehicle(playerEntity, true, true, 0) end
8120 end
8121 end
8122 else
8123 SetPlayerWeaponDamageModifier(PlayerId(), 1.0)
8124 end
8125
8126 Wait(0)
8127 end
8128 end)
8129
8130 local function CustomRightBadge(item, badge, width, height, offsetX, offsetY)
8131 item:SetRightBadge(badge)
8132 item.RightBadge.Sprite.Width = width
8133 item.RightBadge.Sprite.Height = height
8134 item:RightBadgeOffset(offsetX, offsetY)
8135 end
8136
8137 local function AddPlayerOptionsMenu(menu)
8138 local PlayerOptionsMenu = (HoaxMenuPool:AddSubMenu(menu, "Player Options"))
8139 PlayerOptionsMenu.Item:RightLabel("→→")
8140 PlayerOptionsMenu = PlayerOptionsMenu.SubMenu
8141
8142 local playerScenarios = NativeUI.CreateListItem("Player Scenarios", PedScenarios.Scenarios, 1, "Select a scenario and hit enter to start it. Selecting another scenario will override the current scenario. If you're already playing the selected scenario, selecting it again will stop the scenario.");
8143 PlayerOptionsMenu:AddItem(playerScenarios)
8144 playerScenarios.OnListSelected = function(menu, item, index) PlayScenario(PedScenarios.ScenarioNames[item:IndexToItem(index)]) end
8145
8146 local stopScenario = NativeUI.CreateItem("Force Stop Scenario", "This will force a playing scenario to stop immediately, without waiting for it to finish it's 'stopping' animation.")
8147 PlayerOptionsMenu:AddItem(stopScenario)
8148 stopScenario.Activated = function(ParentMenu, SelectedItem) PlayScenario("forcestop") end
8149
8150 local openSkinMenu = NativeUI.CreateItem("~y~ESX: ~s~Open Skin Menu", "")
8151 openSkinMenu.Activated = function(ParentMenu, SelectedItem)
8152 FiveM.TriggerCustomEvent(false, 'esx_skin:openRestrictedMenu', function(data, menu) HoaxMenuPool:CloseAllMenus() end) end
8153 PlayerOptionsMenu:AddItem(openSkinMenu)
8154 FiveM.SetResourceLocked('esx_skin', openSkinMenu)
8155
8156 local revive = NativeUI.CreateItem("~y~ESX: ~b~Revive", "Revive yourself!")
8157 revive.Activated = function(ParentMenu, SelectedItem) FiveM.TriggerCustomEvent(false, 'esx_ambulancejob:revive') end
8158 PlayerOptionsMenu:AddItem(revive)
8159 FiveM.SetResourceLocked('esx_ambulancejob', revive)
8160
8161 local setHunger = NativeUI.CreateItem("~y~ESX: ~g~Hunger ( 100% )", "Set hunger level to 100%")
8162 setHunger.Activated = function(ParentMenu, SelectedItem) FiveM.TriggerCustomEvent(false, 'esx_status:set', "hunger", 1000000) end
8163 PlayerOptionsMenu:AddItem(setHunger)
8164 FiveM.SetResourceLocked('esx_status', setHunger)
8165
8166 local setThirst = NativeUI.CreateItem("~y~ESX: ~g~Thirst ( 100% )", "Set thirst level to 100%")
8167 setThirst.Activated = function(ParentMenu, SelectedItem) FiveM.TriggerCustomEvent(false, 'esx_status:set', "thirst", 1000000) end
8168 PlayerOptionsMenu:AddItem(setThirst)
8169 FiveM.SetResourceLocked('esx_status', setThirst)
8170
8171 local heal = NativeUI.CreateItem("Native: ~g~Heal / Revive", "Revive yourself to 100% health")
8172 heal:RightLabel("💖")
8173 heal.Activated = function(ParentMenu, SelectedItem) CreatePickup(GetHashKey("PICKUP_HEALTH_STANDARD"), GetEntityCoords(GetPlayerPed(-1))) end
8174 PlayerOptionsMenu:AddItem(heal)
8175
8176 local armour = NativeUI.CreateItem("Native: ~b~Give Armour", "Give yourself to 100% armour")
8177 armour.Activated = function(ParentMenu, SelectedItem) CreatePickup(GetHashKey("PICKUP_ARMOUR_STANDARD"), GetEntityCoords(GetPlayerPed(-1))) end
8178 PlayerOptionsMenu:AddItem(armour)
8179
8180 local suicide = NativeUI.CreateItem("~r~Commit Suicide", "Kill yourself by taking the pill. Or by using a pistol if you have one.")
8181 suicide:RightLabel("💀")
8182 suicide.Activated = function(ParentMenu, SelectedItem) SetEntityHealth(PlayerPedId(), 0) end
8183 PlayerOptionsMenu:AddItem(suicide)
8184
8185 local heatVision = NativeUI.CreateCheckboxItem("Heat Vision", enableThermalVision, "Enable Thermal Vision")
8186 heatVision.CheckboxEvent = function(menu, item, enabled) SetSeethrough(enabled) end
8187 PlayerOptionsMenu:AddItem(heatVision)
8188
8189 local nightVision = NativeUI.CreateCheckboxItem("Night Vision", enableNightVision, "Enable Thermal Vision")
8190 nightVision.CheckboxEvent = function(menu, item, enabled) SetNightvision(enabled) end
8191 PlayerOptionsMenu:AddItem(nightVision)
8192
8193 local unlimitedStamina = NativeUI.CreateCheckboxItem("Unlimited Stamina", Enable_InfiniteStamina, "Allows you to run forever without slowing down or taking damage.")
8194 unlimitedStamina.CheckboxEvent = function(menu, item, enabled) Enable_InfiniteStamina = enabled end
8195 PlayerOptionsMenu:AddItem(unlimitedStamina)
8196
8197 local superJump = NativeUI.CreateCheckboxItem("Super Jump", Enable_SuperJump, "Get ~g~Snail~s~ powers and jump like a champ!")
8198 superJump.CheckboxEvent = function(menu, item, enabled) Enable_SuperJump = enabled end
8199 PlayerOptionsMenu:AddItem(superJump)
8200 end
8201
8202 local function AddOnlinePlayersMenu(menu)
8203 local playerServerIdx, SelectedPlayer = 0
8204 local PlayerName = ""
8205
8206 local OnlinePlayersMenu = (HoaxMenuPool:AddSubMenu(menu, "Online Players"))
8207 OnlinePlayersMenu.Item:RightLabel("→→")
8208
8209 local OnlinePlayerOptionsMenu = HoaxMenuPool:AddSubMenu(OnlinePlayersMenu.SubMenu, "Online Player Options")
8210
8211 --[[ Online Player Options ]] do
8212 local Spectate = NativeUI.CreateItem("Spectate Player", "Spectate "..PlayerName..". Click this button again to stop spectating.")
8213 Spectate.Activated = function(ParentMenu, SelectedItem) SpectatePlayer(SelectedPlayer) end
8214 OnlinePlayerOptionsMenu.SubMenu:AddItem(Spectate)
8215
8216 local Teleport = NativeUI.CreateItem("Teleport To Player", "Teleport To "..PlayerName)
8217 Teleport.Activated = function(ParentMenu, SelectedItem) TeleportToPlayer(SelectedPlayer) end
8218 OnlinePlayerOptionsMenu.SubMenu:AddItem(Teleport)
8219
8220 local NativeRevive = NativeUI.CreateItem("Native: Revive", "Native Revive "..PlayerName)
8221 NativeRevive.Activated = function(ParentMenu, SelectedItem) CreatePickup(GetHashKey("PICKUP_HEALTH_STANDARD"), GetEntityCoords(GetPlayerPed(SelectedPlayer))) end
8222 OnlinePlayerOptionsMenu.SubMenu:AddItem(NativeRevive)
8223
8224 local NativeSlay = NativeUI.CreateItem("Native: ~r~Silent Slay", "Silently kill "..PlayerName)
8225 NativeSlay.Activated = function(ParentMenu, SelectedItem)
8226 AddExplosion(GetEntityCoords(GetPlayerPed(SelectedPlayer)), 33, 101.0, false, true, 0.0) end
8227 OnlinePlayerOptionsMenu.SubMenu:AddItem(NativeSlay)
8228
8229 local NativeExplode = NativeUI.CreateItem("Native: ~r~Explode", "Explode "..PlayerName.." and surroundings!")
8230 NativeExplode.Activated = function(ParentMenu, SelectedItem) AddExplosion(GetEntityCoords(GetPlayerPed(SelectedPlayer)), 2, 1337.0, false, true, 0.0) end
8231 OnlinePlayerOptionsMenu.SubMenu:AddItem(NativeExplode)
8232
8233 local StopActions = NativeUI.CreateItem("Native: ~o~Stop All Actions", "Stop all actions for "..PlayerName.." including kicking from vehicle!")
8234 StopActions.Activated = function(ParentMenu, SelectedItem) ClearPedTasksImmediately(GetPlayerPed(SelectedPlayer)) end
8235 OnlinePlayerOptionsMenu.SubMenu:AddItem(StopActions)
8236
8237 local StopDrag = NativeUI.CreateItem("Native: ~o~Stop Drag", "Stop drag for "..PlayerName)
8238 StopDrag.Activated = function(ParentMenu, SelectedItem) DetachEntity(GetPlayerPed(SelectedPlayer), true, false) end
8239 OnlinePlayerOptionsMenu.SubMenu:AddItem(StopDrag)
8240
8241
8242 local maxTuneVehicle = NativeUI.CreateItem("Max Tune Vehicle", "Max tune "..PlayerName.."'s vehicle.")
8243 maxTuneVehicle.Activated = function(ParentMenu, SelectedItem)
8244 if IsPedInAnyVehicle(GetPlayerPed(SelectedPlayer)) then
8245 MaxTuneVehicle(GetPlayerPed(SelectedPlayer))
8246 else
8247 FiveM.Notify("Player must be in a ~r~vehicle ~w~to use this !", NotificationType.Error)
8248 end
8249 end
8250 OnlinePlayerOptionsMenu.SubMenu:AddItem(maxTuneVehicle)
8251
8252 local cloneVehicle = NativeUI.CreateItem("~s~Clone Vehicle", "Clone "..PlayerName.."'s Vehicle")
8253 cloneVehicle.Activated = function(ParentMenu, SelectedItem)
8254 local selectedPlayerPed = GetPlayerPed(SelectedPlayer)
8255 local selectedPlayerVehicle = nil
8256
8257 if IsPedInAnyVehicle(selectedPlayerPed) then selectedPlayerVehicle = GetVehiclePedIsIn(selectedPlayerPed, false)
8258 else selectedPlayerVehicle = GetVehiclePedIsIn(selectedPlayerPed, true) end
8259
8260 if DoesEntityExist(selectedPlayerVehicle) then
8261 local vehicleModel = GetEntityModel(selectedPlayerVehicle)
8262 local spawnedVehicle = SpawnVehicleToPlayer(vehicleModel, PlayerId())
8263
8264 local vehicleProperties = FiveM.GetVehicleProperties(selectedPlayerVehicle)
8265 vehicleProperties.plate = nil
8266
8267 FiveM.SetVehicleProperties(spawnedVehicle, vehicleProperties)
8268
8269 SetVehicleEngineOn(spawnedVehicle, true, false, false)
8270 SetVehRadioStation(spawnedVehicle, 'OFF')
8271 end
8272 end
8273 OnlinePlayerOptionsMenu.SubMenu:AddItem(cloneVehicle)
8274
8275 local spawnWeapon = NativeUI.CreateItem("~s~Spawn Weapon", "Spawn Weapon To "..PlayerName)
8276 spawnWeapon.Activated = function(ParentMenu, SelectedItem)
8277 SpawnWeaponMenu(OnlinePlayerOptionsMenu.SubMenu, GetPlayerPed(SelectedPlayer));
8278 end
8279 OnlinePlayerOptionsMenu.SubMenu:AddItem(spawnWeapon)
8280
8281 local crashPlayer = NativeUI.CreateItem("~s~Crash Player", "Crash "..PlayerName)
8282 crashPlayer.Activated = function(ParentMenu, SelectedItem)
8283 Citizen.CreateThread(function()
8284 local playerPed = GetPlayerPed(SelectedPlayer);
8285 local objectNetId = nil;
8286 while objectNetId == nil do
8287 objectNetId = ObjToNet(CreateObjectNoOffset(crashStyles[index], GetEntityCoords(playerPed), 1, 1, 1) );
8288 Wait(0);
8289 end
8290 local object = NetToObj(objectNetId);
8291 print("Object "..tostring(object).."'s Location: "..tostring(GetEntityCoords(object)))
8292 Wait(5000);
8293 if ShowMenu and DoesEntityExist(object) then
8294 print("Trying to remove object : "..object)
8295 RequestModel(-508849828)
8296 while not HasModelLoaded(-508849828) do
8297 Wait(1)
8298 end
8299 local pedestrian = CreatePed(1, -508849828, 0.0, 0.0, 1000.0, 31.0, false, true);
8300 SetEntityInvincible(pedestrian, true)
8301 FreezeEntityPosition(pedestrian, true)
8302 while GetEntityCoords(pedestrian).z < 1000 do
8303 DeleteEntity(pedestrian);
8304 pedestrian = CreatePed(1, -508849828, 0.0, 0.0, 1000.0, 31.0, false, true);
8305 Wait(1)
8306 end
8307 print("Ped "..tostring(pedestrian).."'s Location: "..tostring(GetEntityCoords(pedestrian)))
8308 Wait(1000)
8309 SetEntityAsNoLongerNeeded(object);
8310 SetEntityAsMissionEntity(object, true, true);
8311 Wait(1000);
8312 AttachEntityToEntity(
8313 object, pedestrian, GetEntityBoneIndexByName(pedestrian, "IK_L_Hand"), 0.0, -0.05, -0.10, -30.0, 180.0, 40.0, 0, 0, 1, 0, 0, 1
8314 )
8315 Wait(1000);
8316 print("Object "..tostring(object).."'s Location: "..tostring(GetEntityCoords(object)))
8317 DeleteEntity(pedestrian);
8318 Wait(100);
8319 print("Has ControlOfNetworkId: "..tostring(NetworkRequestControlOfNetworkId(objectNetId)));
8320 print("Has ControlOfEntity: "..tostring(NetworkRequestControlOfEntity(object)));
8321 Wait(100);
8322 SetEntityAsNoLongerNeeded(object);
8323 SetEntityAsMissionEntity(object, true, true);
8324 Wait(100);
8325 DetachEntity(object, 1, 1);
8326 Wait(100);
8327 DeleteEntity(object);
8328 Wait(100);
8329 print("Object Exists: "..tostring(DoesEntityExist(object)).." & Ped Exists: "..tostring(DoesEntityExist(pedestrian)));
8330 end
8331 end)
8332 end
8333 OnlinePlayerOptionsMenu.SubMenu:AddItem(crashPlayer)
8334
8335 local spawnPawned = NativeUI.CreateItem("~s~Spawn Pawners", "Kill" .. PlayerName .. "With Driving Ped")
8336 spawnPawned.Activated = function(ParentMenu, SelectedItem)
8337 Citizen.CreateThread(function()
8338 local veh = vehlist[math.random(#vehlist)]
8339 local pos = GetEntityCoords(GetPlayerPed(SelectedPlayer))
8340 local pitch = GetEntityPitch(GetPlayerPed(SelectedPlayer))
8341 local roll = GetEntityRoll(GetPlayerPed(SelectedPlayer))
8342 local yaw = GetEntityRotation(GetPlayerPed(SelectedPlayer)).z
8343 local xf = GetEntityForwardX(GetPlayerPed(SelectedPlayer))
8344 local yf = GetEntityForwardY(GetPlayerPed(SelectedPlayer))
8345 if IsPedInAnyVehicle(GetPlayerPed(SelectedPlayer), false) then
8346 local vt = GetVehiclePedIsIn(GetPlayerPed(SelectedPlayer), 0)
8347 NetworkRequestControlOfEntity(vt)
8348 SetVehicleModKit(vt, 0)
8349 ToggleVehicleMod(vt, 20, 1)
8350 SetVehicleModKit(vt, 0)
8351 SetVehicleTyresCanBurst(vt, 1)
8352 end
8353 local v = nil
8354 RequestModel(veh)
8355 RequestModel('s_m_y_swat_01')
8356 while not HasModelLoaded(veh) and not HasModelLoaded('s_m_y_swat_01') do
8357 RequestModel('s_m_y_swat_01')
8358 Citizen.Wait(0)
8359 RequestModel(veh)
8360 end
8361 if HasModelLoaded(veh) then
8362 Citizen.Wait(50)
8363 v = CreateVehicle(veh, pos.x - (xf * 10), pos.y - (yf * 10), pos.z + 1, GetEntityHeading(GetPlayerPed(SelectedPlayer)), true, false)
8364 if DoesEntityExist(v) then
8365 NetworkRequestControlOfEntity(v)
8366 SetVehicleDoorsLocked(v, 4)
8367 RequestModel('s_m_y_swat_01')
8368 Citizen.Wait(50)
8369 if HasModelLoaded('s_m_y_swat_01') then
8370 Citizen.Wait(50)
8371 local ped = CreatePed(21, GetHashKey('s_m_y_swat_01'), pos.x, pos.y, pos.z, true, true)
8372 local ped1 = CreatePed(21, GetHashKey('s_m_y_swat_01'), pos.x, pos.y, pos.z, true, true)
8373 if DoesEntityExist(ped1) and DoesEntityExist(ped) then
8374 GiveWeaponToPed(ped, GetHashKey('WEAPON_APPISTOL'), 9999, 1, 1)
8375 GiveWeaponToPed(ped1, GetHashKey('WEAPON_APPISTOL'), 9999, 1, 1)
8376 SetPedIntoVehicle(ped, v, -1)
8377 SetPedIntoVehicle(ped1, v, 0)
8378 TaskDriveBy(ped, GetVehiclePedIsUsing(GetPlayerPed(SelectedPlayer)), pos.x, pos.y, pos.z, 200, 99, 0,
8379 'FIRING_PATTERN_BURST_FIRE_DRIVEBY')
8380 TaskShootAtEntity(ped1, GetVehiclePedIsUsing(GetPlayerPed(SelectedPlayer)), 200, 'FIRING_PATTERN_BURST_FIRE_DRIVEBY')
8381 makePedHostile(ped, SelectedPlayer, 0, 0)
8382 makePedHostile(ped1, SelectedPlayer, 0, 0)
8383 TaskCombatPed(ped, GetPlayerPed(SelectedPlayer), 0, 16)
8384 TaskCombatPed(ped1, GetPlayerPed(SelectedPlayer), 0, 16)
8385 SetEntityInvincible(ped, true)
8386 SetEntityInvincible(ped1, true)
8387 for i = 1, 2 do
8388 Citizen.Wait(5)
8389 ClearPedTasks(GetPlayerPed(-1))
8390 end
8391 end
8392 end
8393 end
8394 end
8395 end)
8396 end
8397 OnlinePlayerOptionsMenu.SubMenu:AddItem(spawnPawned)
8398
8399 local spawnJesus = NativeUI.CreateItem("~s~Spawn Jesus", "God Bless "..PlayerName)
8400 spawnJesus.Activated = function(ParentMenu, SelectedItem)
8401 local pos = GetEntityCoords(GetPlayerPed(SelectedPlayer))
8402 local ped = CreatePed(21, GetHashKey('u_m_m_jesus_01'), pos.x, pos.y, pos.z, true, true)
8403 TaskCombatPed(ped, GetPlayerPed(SelectedPlayer), 0, 16)
8404 Citizen.Wait(5000)
8405 DeletePed(ped)
8406 end
8407 OnlinePlayerOptionsMenu.SubMenu:AddItem(spawnJesus)
8408 end
8409
8410 --[[ Online Player EasyAdmin Menu ]]
8411 local EasyAdmin = (HoaxMenuPool:AddSubMenu(OnlinePlayerOptionsMenu.SubMenu, "EasyAdmin → Triggers", "EasyAdmin Triggers"))
8412 EasyAdmin.Item:RightLabel("→→")
8413 EasyAdmin = EasyAdmin.SubMenu
8414
8415 --[[ Online Player EasyAdmin Triggers ]] do
8416 local EasyAdminSlay = NativeUI.CreateItem("~y~EasyAdmin: ~r~Slay Player", "Ban "..PlayerName)
8417 EasyAdminSlay.Activated = function(ParentMenu, SelectedItem)
8418 FiveM.TriggerCustomEvent(true, 'EasyAdmin:SlapPlayer', PlayerServerIdx, 10) end
8419 EasyAdmin:AddItem(EasyAdminSlay)
8420 FiveM.SetResourceLocked('EasyAdmin', EasyAdminSlay)
8421
8422 local EasyAdminBan = NativeUI.CreateItem("~y~EasyAdmin: ~r~Ban Player", "Ban "..PlayerName)
8423 EasyAdminBan.Activated = function(ParentMenu, SelectedItem)
8424 FiveM.TriggerCustomEvent(true, 'EasyAdmin:banPlayer', PlayerServerIdx, "cauz you stoopid", 10444633200, PlayerName) end
8425 EasyAdmin:AddItem(EasyAdminBan)
8426 FiveM.SetResourceLocked('EasyAdmin', EasyAdminBan)
8427
8428 local EasyAdminFreeze = NativeUI.CreateItem("~y~EasyAdmin: ~r~Freeze Player", "Freeze "..PlayerName)
8429 EasyAdminFreeze.Activated = function(ParentMenu, SelectedItem)
8430 FiveM.TriggerCustomEvent(true, 'EasyAdmin:FreezePlayer', PlayerServerIdx, true) end
8431 EasyAdmin:AddItem(EasyAdminFreeze)
8432 FiveM.SetResourceLocked('EasyAdmin', EasyAdminFreeze)
8433
8434 local EasyAdminTeleport = NativeUI.CreateItem("~y~EasyAdmin: ~r~Teleport Player", "Teleport "..PlayerName)
8435 EasyAdminTeleport.Activated = function(ParentMenu, SelectedItem)
8436 local x, y, z = table.unpack(GetEntityCoords(PlayerPedId(), false))
8437 FiveM.TriggerCustomEvent(true, 'EasyAdmin:TeleportPlayerToCoords', PlayerServerIdx, x, y, z) end
8438 EasyAdmin:AddItem(EasyAdminTeleport)
8439 FiveM.SetResourceLocked('EasyAdmin', EasyAdminTeleport)
8440 end
8441
8442 --[[ Online Player ESX Trigger Menu ]]
8443 local ESXTriggers = (HoaxMenuPool:AddSubMenu(OnlinePlayerOptionsMenu.SubMenu, "ESX → Triggers", "ESX Based Triggers"))
8444 ESXTriggers.Item:RightLabel("→→")
8445 ESXTriggers = ESXTriggers.SubMenu
8446
8447 --[[ Online Player ESX Triggers ]] do
8448 local ESXRevive = NativeUI.CreateItem("~y~ESX: ~b~Revive", "Revive "..PlayerName)
8449 ESXRevive.Activated = function(ParentMenu, SelectedItem)
8450 FiveM.TriggerCustomEvent(true, 'esx_ambulancejob:revive', GetPlayerServerId(SelectedPlayer))
8451 FiveM.TriggerCustomEvent(true, 'esx_ambulancejob:revive', SelectedPlayer)
8452 end
8453 ESXTriggers:AddItem(ESXRevive)
8454 FiveM.SetResourceLocked('esx_ambulancejob', ESXRevive)
8455
8456 local ESXJail = NativeUI.CreateItem("~y~ESX: ~r~Jail Player", "Jail "..PlayerName.." for 45 Minutes")
8457 ESXJail.Activated = function(ParentMenu, SelectedItem)
8458 FiveM.TriggerCustomEvent(true, 'esx_jailer:sendToJail', GetPlayerServerId(selectedPlayerIdx), 45 * 60)
8459 FiveM.TriggerCustomEvent(true, 'esx_jail:sendToJail', GetPlayerServerId(selectedPlayerIdx), 45 * 60)
8460 FiveM.TriggerCustomEvent(true, 'js:jailuser', GetPlayerServerId(selectedPlayerIdx), 45 * 60, "dude weed")
8461 end
8462 ESXTriggers:AddItem(ESXJail)
8463 FiveM.SetResourceLocked('esx_jailer', ESXJail)
8464 FiveM.SetResourceLocked('esx_jail', ESXJail)
8465 FiveM.SetResourceLocked('js', ESXJail)
8466
8467 local ESXChangeName = NativeUI.CreateItem("~y~ESX: ~s~Change Name", "Change Name of "..PlayerName)
8468 ESXChangeName.Activated = function(ParentMenu, SelectedItem)
8469 local FirstName = FiveM.GetKeyboardInput("Enter FirstName", "", 50)
8470 local LastName = FiveM.GetKeyboardInput("Enter LastName", "", 50)
8471
8472 if ESX ~= nil then
8473 ESX.TriggerServerCallback('esx_society:getOnlinePlayers', function(players)
8474 local xPlayer = nil
8475 for i = 1, #players do
8476 if players[i].name == GetPlayerName(SelectedPlayer) then xPlayer = players[i] end
8477 end
8478
8479 if xPlayer ~= nil then
8480 local data = {
8481 identifier = xPlayer.identifier,
8482 firstname = FirstName,
8483 lastname = LastName
8484 }
8485 local myidentifiers = { steamid = xPlayer.identifier }
8486 FiveM.TriggerCustomEvent(true, 'esx_identity:setIdentity', data, myidentifiers)
8487 Citizen.Wait(500)
8488 else
8489 FiveM.Notify("No Player Found", NotificationType.Error)
8490 end
8491 end)
8492 end
8493 end
8494 ESXTriggers:AddItem(ESXChangeName)
8495 FiveM.SetResourceLocked('esx_identity', ESXChangeName)
8496
8497 local ESXChangeJob = NativeUI.CreateListItem("~y~ESX: ~s~Change Job", Jobs, 1)
8498 ESXChangeJob:Description("Change "..PlayerName.." Job to "..Jobs[ESXChangeJob:Index()])
8499 ESXChangeJob.OnListSelected = function(menu, item, index)
8500 local JobGrade = FiveM.GetKeyboardInput("Enter JobGrade", "", 2)
8501 SetPlayerJob(SelectedPlayer, Jobs.Type[ESXChangeJob:IndexToItem(index)], JobGrade, true) end
8502 ESXTriggers:AddItem(ESXChangeJob)
8503 FiveM.SetResourceLocked('esx_society', ESXChangeJob)
8504
8505 local ESXSpawnLegalVehicle = NativeUI.CreateItem("~y~ESX: ~s~Spawn Legal Vehicle", "Spawn a custom legal vehicle to "..PlayerName)
8506 ESXSpawnLegalVehicle.Activated = function(ParentMenu, SelectedItem)
8507 local ModelName = FiveM.GetKeyboardInput("Enter Vehicle Spawn Name", "", 10)
8508 local PlateNumber = FiveM.GetKeyboardInput("Enter Vehicle Plate Number", "", 8)
8509 SpawnLegalVehicle(ModelName, SelectedPlayer, PlateNumber); end
8510 ESXTriggers:AddItem(ESXSpawnLegalVehicle)
8511 FiveM.SetResourceLocked('esx_vehicleshop', ESXSpawnLegalVehicle)
8512
8513 local ESXFakeMessage = NativeUI.CreateItem("~y~ESX: ~s~Fake Message", "Send a fake message from "..PlayerName)
8514 ESXFakeMessage.Activated = function(ParentMenu, SelectedItem)
8515 local message = FiveM.GetKeyboardInput("Enter the fake message!", "", 100)
8516 if not string.IsNullOrEmpty(message) then
8517 FiveM.TriggerCustomEvent(true, '_chat:messageEntered', GetPlayerName(SelectedPlayer), {0, 0x99, 255}, message)
8518 end
8519 end
8520 ESXTriggers:AddItem(ESXFakeMessage)
8521 end
8522
8523 OnlinePlayerOptionsMenu.SubMenu.OnMenuChanged = function(menu, newmenu, forward)
8524 if not forward then
8525 OnlinePlayersMenu.SubMenu:Clear()
8526
8527 for playerId = 0, 128 do
8528 if NetworkIsPlayerActive(playerId) and GetPlayerServerId(playerId) ~= 0 then
8529 local OnlinePlayerOptions = NativeUI.CreateItem(FiveM.GetSafePlayerName(GetPlayerName(playerId)),
8530 string.format("Click to view the options for this player.\nServer ID:%i Local ID:%i", GetPlayerServerId(playerId), playerId))
8531 CustomRightBadge(OnlinePlayerOptions, BadgeStyle.ArrowRight, 25, 25, 5, 4)
8532 OnlinePlayerOptions:RightLabel(IsPedDeadOrDying(GetPlayerPed(playerId), 1) and "💀" or "💖")
8533 OnlinePlayersMenu.SubMenu:BindMenuToItem(OnlinePlayerOptionsMenu.SubMenu, OnlinePlayerOptions)
8534
8535 OnlinePlayersMenu.SubMenu:AddItem(OnlinePlayerOptions)
8536 end
8537 end
8538
8539 OnlinePlayersMenu.SubMenu:RefreshIndex();
8540 end
8541 end
8542
8543 OnlinePlayersMenu.Item.Activated = function(ParentMenu, SelectedItem)
8544 OnlinePlayersMenu.SubMenu:Clear()
8545
8546 for playerId = 0, 128 do
8547 if NetworkIsPlayerActive(playerId) and GetPlayerServerId(playerId) ~= 0 then
8548 local OnlinePlayerOptions = NativeUI.CreateItem(FiveM.GetSafePlayerName(GetPlayerName(playerId)),
8549 string.format("Click to view the options for this player.\nServer ID:%i Local ID:%i", GetPlayerServerId(playerId), playerId))
8550 CustomRightBadge(OnlinePlayerOptions, BadgeStyle.ArrowRight, 25, 25, 5, 4)
8551 OnlinePlayerOptions:RightLabel(IsPedDeadOrDying(GetPlayerPed(playerId), 1) and "💀" or "💖")
8552 OnlinePlayersMenu.SubMenu:BindMenuToItem(OnlinePlayerOptionsMenu.SubMenu, OnlinePlayerOptions)
8553
8554 OnlinePlayersMenu.SubMenu:AddItem(OnlinePlayerOptions)
8555 end
8556 end
8557
8558 OnlinePlayersMenu.SubMenu:RefreshIndex();
8559 end
8560
8561 OnlinePlayersMenu.SubMenu.OnItemSelect = function(sender, item, index)
8562 local Description = item:Description()
8563 playerServerIdx, SelectedPlayer = Description:match('.*:(%d+).*:(%d+)')
8564 playerServerIdx = tonumber(playerServerIdx);
8565 SelectedPlayer = tonumber(SelectedPlayer);
8566 PlayerName = FiveM.GetSafePlayerName(GetPlayerName(SelectedPlayer))
8567 OnlinePlayerOptionsMenu.SubMenu.Subtitle.Text:Text(PlayerName.." → Options")
8568 end
8569
8570 end
8571
8572 local function AddTeleportMenu(menu)
8573 local TeleportMenu = (HoaxMenuPool:AddSubMenu(menu, "Teleport Options"))
8574 TeleportMenu.Item:RightLabel("→→")
8575 TeleportMenu = TeleportMenu.SubMenu
8576
8577 local TeleportToWayPoint = NativeUI.CreateItem("Teleport To ~b~Waypoint", "Teleport using ~g~Snail~s~ powers!")
8578 TeleportToWayPoint.Activated = function(ParentMenu, SelectedItem)
8579 Citizen.CreateThread(function()
8580 local waypoint = FiveM.GetWaypoint();
8581 if waypoint ~= 0 and waypoint ~= nil then FiveM.TeleportToCoords(waypoint) end
8582 end) end
8583 TeleportMenu:AddItem(TeleportToWayPoint)
8584 end
8585
8586 local function AddWeaponOptionsMenu(menu)
8587 local WeaponOptionsMenu = (HoaxMenuPool:AddSubMenu(menu, "Weapon Options"))
8588 WeaponOptionsMenu.Item:RightLabel("→→")
8589 WeaponOptionsMenu = WeaponOptionsMenu.SubMenu
8590
8591 local WeaponSpawnMenu = (HoaxMenuPool:AddSubMenu(WeaponOptionsMenu, "Spawn Weapon"))
8592 WeaponSpawnMenu.Item:RightLabel("→→")
8593 WeaponSpawnMenu = WeaponSpawnMenu.SubMenu
8594
8595 local removeAllWeapons = NativeUI.CreateItem("Remove All Weapons", "Removes all weapons in your inventory.")
8596 removeAllWeapons.Activated = function(menu, item, index) RemoveAllPedWeapons(PlayerPedId(), true) end
8597 WeaponOptionsMenu:AddItem(removeAllWeapons)
8598
8599 SpawnWeaponMenu(WeaponSpawnMenu, PlayerPedId())
8600 end
8601
8602 local function AddVehicleAutoPilot(menu)
8603 local vehicleAutoPilotMenu = (HoaxMenuPool:AddSubMenu(menu, "Vehicle Auto Pilot", "Manage vehicle auto pilot options."))
8604 vehicleAutoPilotMenu.Item:RightLabel("→→")
8605 vehicleAutoPilotMenu = vehicleAutoPilotMenu.SubMenu
8606
8607 local StyleFromIndex = {
8608 [1] = 431,
8609 [2] = 1074528293,
8610 [3] = 536871355,
8611 [4] = 1467,
8612 }
8613
8614 local drivingStyles = { "Normal", "Rushed", "Avoid highways", "Drive in reverse" }
8615 local drivingStyle = NativeUI.CreateListItem("Driving Style", drivingStyles, 1, "Set the driving style that is used for the Drive to Waypoint and Drive Around Randomly functions.")
8616 drivingStyle.OnListSelected = function(menu, item, index)
8617 SetDriveTaskDrivingStyle(PlayerPedId(), StyleFromIndex[index]) end
8618 vehicleAutoPilotMenu:AddItem(drivingStyle)
8619
8620 local startDrivingWaypoint = NativeUI.CreateItem("Drive To Waypoint", "Make your player ped drive your vehicle to your waypoint.")
8621 vehicleAutoPilotMenu:AddItem(startDrivingWaypoint)
8622
8623 local startDrivingRandomly = NativeUI.CreateItem("Drive Around Randomly", "Make your player ped drive your vehicle randomly around the map.");
8624 vehicleAutoPilotMenu:AddItem(startDrivingRandomly)
8625
8626 local stopDriving = NativeUI.CreateItem("Park Vehicle", "The player ped will find a suitable place to stop the vehicle. The task will be stopped once the vehicle has reached the suitable stop location.");
8627 vehicleAutoPilotMenu:AddItem(stopDriving)
8628
8629 local forceStopDriving = NativeUI.CreateItem("Stop Driving", "This will stop the driving task immediately without finding a suitable place to stop.");
8630 vehicleAutoPilotMenu:AddItem(forceStopDriving)
8631
8632
8633 vehicleAutoPilotMenu.OnItemSelect = function(sender, item, index)
8634 local playerPed = GetPlayerPed(-1)
8635 local style = StyleFromIndex[drivingStyle:Index()]
8636 if (IsPedInAnyVehicle(playerPed, false) and item ~= stopDriving and item ~= forceStopDriving) then
8637 local vehicle = GetVehiclePedIsIn(playerPed, false)
8638 if (vehicle ~=nil and DoesEntityExist(vehicle) and IsVehicleDriveable(vehicle, false)) then
8639 if (GetPedInVehicleSeat(vehicle, -1)) then
8640 if (item == startDrivingWaypoint) then
8641 if (DoesBlipExist(GetFirstBlipInfoId(8))) then
8642 DriveToWaypoint(style)
8643 FiveM.Notify("Your player ped is now driving the vehicle for you. You can cancel any time by pressing the Stop Driving button. The vehicle will stop when it has reached the destination.", NotificationType.Info)
8644 else
8645 FiveM.Notify("You need a waypoint before you can drive to it!", NotificationType.Error)
8646 end
8647 elseif (item == startDrivingRandomly) then
8648 DriveWander(style)
8649 FiveM.Notify("Your player ped is now driving the vehicle for you. You can cancel any time by pressing the Stop Driving button.", NotificationType.Info)
8650 end
8651 else
8652 FiveM.Notify("You must be the driver of this vehicle!", NotificationType.Error)
8653 end
8654 else
8655 FiveM.Notify("Your vehicle is broken or it does not exist!", NotificationType.Error)
8656 end
8657 elseif (item ~= stopDriving and item ~= forceStopDriving) then
8658 FiveM.Notify("You need to be in a vehicle first!", NotificationType.Error)
8659 end
8660 if item == stopDriving then
8661 if (IsPedInAnyVehicle(playerPed, false)) then
8662 local vehicle = GetVehiclePedIsIn(playerPed, false)
8663 if (vehicle ~=nil and DoesEntityExist(vehicle) and IsVehicleDriveable(vehicle, false)) then
8664 ParkVehicle(vehicle)
8665 end
8666 else
8667 ClearPedTasks(playerPed)
8668 FiveM.Notify("Your ped is not in any vehicle.", NotificationType.Alert);
8669 end
8670 elseif item == forceStopDriving then
8671 DriveWanderTaskActive = false
8672 DriveToWpTaskActive = false
8673 SetEntityMaxSpeed(GetVehiclePedIsIn(GetPlayerPed(-1), 0), 500.01);
8674 ClearPedTasks(playerPed);
8675 FiveM.Notify("Driving task cancelled.", NotificationType.Info);
8676 end
8677 end
8678 end
8679
8680 local function AddVehicleOptionsMenu(menu)
8681 local VehicleOptionsMenu = (HoaxMenuPool:AddSubMenu(menu, "Vehicle Options"))
8682 VehicleOptionsMenu.Item:RightLabel("→→")
8683 VehicleOptionsMenu = VehicleOptionsMenu.SubMenu
8684
8685 AddVehicleAutoPilot(VehicleOptionsMenu)
8686
8687 local vehicleMaxSpeed = NativeUI.CreateListItem("Set Vehicle Speed", VehicleMaxSpeeds, 11)
8688 vehicleMaxSpeed.OnListSelected = function(menu, item, index)
8689 if IsPedInAnyVehicle(GetPlayerPed(-1)) then
8690 local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false)
8691 if index == 1 then SetEntityMaxSpeed(vehicle, 500.0);
8692 else SetEntityMaxSpeed(vehicle, tonumber(vehicleMaxSpeed:IndexToItem(index))/3.6); end;
8693 else FiveM.Notify("You must be in a ~r~vehicle ~w~to use this !", NotificationType.Error); end; end
8694 VehicleOptionsMenu:AddItem(vehicleMaxSpeed)
8695
8696 --[[ Spawn Vehicle Options ]]
8697 local vehicleTypes = NativeUI.CreateListItem("Car Types", CarTypes, 1)
8698 VehicleOptionsMenu:AddItem(vehicleTypes)
8699
8700 local spawnVehicle = NativeUI.CreateListItem("Spawn Vehicle", CarsArray[1], 1)
8701 VehicleOptionsMenu:AddItem(spawnVehicle)
8702
8703 vehicleTypes.OnListChanged = function(menu, item, index) spawnVehicle.Items = CarsArray[index]; spawnVehicle:Index(1) end
8704 spawnVehicle.OnListSelected = function(menu, item, index) SpawnVehicleToPlayer(CarsArray[vehicleTypes:Index()][index], PlayerId()) end
8705
8706 local spawnLegalVehicle = NativeUI.CreateItem("Spawn Legal Vehicle", "Spawn a custom legal vehicle.")
8707 spawnLegalVehicle.Activated = function(ParentMenu, SelectedItem)
8708 local ModelName = FiveM.GetKeyboardInput("Enter Vehicle Spawn Name", "", 10)
8709 local PlateNumber = FiveM.GetKeyboardInput("Enter Vehicle Plate Number", "", 8)
8710 SpawnLegalVehicle(ModelName, PlayerId(), PlateNumber) end
8711 VehicleOptionsMenu:AddItem(spawnLegalVehicle)
8712 FiveM.SetResourceLocked('esx_vehicleshop', refuelVehicle)
8713
8714 local repairVehicle = NativeUI.CreateItem("~b~Repair Vehicle", "Repair any visual and physical damage present on your vehicle.")
8715 repairVehicle:RightLabel("🔧")
8716 repairVehicle.Activated = function(ParentMenu, SelectedItem)
8717 local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false)
8718 SetVehicleFixed(vehicle)
8719 SetVehicleDeformationFixed(vehicle)
8720 SetVehicleUndriveable(vehicle, false)
8721 SetVehicleEngineOn(vehicle, true, true)
8722 SetVehicleLights(vehicle, 0)
8723 SetVehicleBurnout(vehicle, false)
8724 N_0x1fd09e7390a74d54(vehicle, 0) end
8725 VehicleOptionsMenu:AddItem(repairVehicle)
8726
8727 local refuelVehicle = NativeUI.CreateItem("~g~Refuel Vehicle", "Refuel the vehicle.")
8728 refuelVehicle:RightLabel("⛽")
8729 refuelVehicle.Activated = function(ParentMenu, SelectedItem)
8730 if IsPedInAnyVehicle(GetPlayerPed(-1)) then
8731 local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false)
8732 FiveM.TriggerCustomEvent(false, 'advancedFuel:setEssence', 100, GetVehicleNumberPlateText(vehicle),
8733 GetDisplayNameFromVehicleModel(GetEntityModel(vehicle)))
8734 SetVehicleEngineOn(vehicle, true, false, false)
8735 SetVehicleUndriveable(vehicle, false)
8736 else FiveM.Notify("You must be in a ~r~vehicle ~w~to use this !", NotificationType.Error) end end;
8737 VehicleOptionsMenu:AddItem(refuelVehicle)
8738 FiveM.SetResourceLocked('advancedFuel', refuelVehicle)
8739
8740 local maxTuneVehicle = NativeUI.CreateItem("Max Tune", "Max tune your vehicle.")
8741 maxTuneVehicle.Activated = function(ParentMenu, SelectedItem)
8742 if IsPedInAnyVehicle(GetPlayerPed(-1)) then MaxTuneVehicle(GetPlayerPed(-1));
8743 else FiveM.Notify("You must be in a ~r~vehicle ~w~to use this !", NotificationType.Error); end; end;
8744 VehicleOptionsMenu:AddItem(maxTuneVehicle)
8745
8746 local sellVehicle = NativeUI.CreateItem("Sell Vehicle", "Sell your current vehicle.")
8747 sellVehicle.Activated = function(ParentMenu, SelectedItem)
8748 if IsPedInAnyVehicle(GetPlayerPed(-1)) then
8749 if ESX ~= nil then
8750 local vehicleProperties = FiveM.GetVehicleProperties(GetVehiclePedIsIn(GetPlayerPed(-1), false))
8751 ESX.TriggerServerCallback('esx_vehicleshop:resellVehicle', function(vehicleSold) end, vehicleProperties.plate, vehicleProperties.model)
8752 else FiveM.Notify("Trouble with ESX!", NotificationType.Error) end;
8753 else FiveM.Notify("You must be in a ~r~vehicle ~w~to use this !", NotificationType.Error) end; end;
8754 VehicleOptionsMenu:AddItem(sellVehicle)
8755 FiveM.SetResourceLocked('esx_vehicleshop', sellVehicle)
8756
8757 local stealVehicle = NativeUI.CreateItem("Steal Vehicle", "Steal this current vehicle.")
8758 stealVehicle.Activated = function(ParentMenu, SelectedItem)
8759 if IsPedInAnyVehicle(GetPlayerPed(-1)) then
8760 local SpawnedVehicleProperties = FiveM.GetVehicleProperties(GetVehiclePedIsIn(GetPlayerPed(-1), false))
8761 local SpawnedVehicleModel = SpawnedVehicleProperties.model
8762 local SpawnedVehicleModelName = GetDisplayNameFromVehicleModel(SpawnedVehicleModel)
8763 if SpawnedVehicleProperties then
8764 FiveM.TriggerCustomEvent(true, 'esx_vehicleshop:setVehicleOwnedPlayerId', GetPlayerServerId(PlayerId()), SpawnedVehicleProperties, SpawnedVehicleModelName, SpawnedVehicleModel, false)
8765 FiveM.Notify("~g~~h~You own this spawned vehicle!", NotificationType.Success)
8766 end
8767 else FiveM.Notify("You must be in a ~r~vehicle ~w~to use this !", NotificationType.Error) end end
8768 VehicleOptionsMenu:AddItem(stealVehicle)
8769 FiveM.SetResourceLocked('esx_vehicleshop', stealVehicle)
8770
8771 local deleteVehicle = NativeUI.CreateItem("Delete Vehicle", "Delete your vehicle.")
8772 deleteVehicle.Activated = function(ParentMenu, SelectedItem) FiveM.DeleteVehicle(GetVehiclePedIsIn(GetPlayerPed(-1))) end
8773 VehicleOptionsMenu:AddItem(deleteVehicle)
8774
8775 local dirtyVehicle = NativeUI.CreateItem("Dirty Vehicle", "Make your vehicle dirty.")
8776 dirtyVehicle.Activated = function(ParentMenu, SelectedItem) FiveM.DirtyVehicle(GetVehiclePedIsIn(GetPlayerPed(-1))) end
8777 VehicleOptionsMenu:AddItem(dirtyVehicle)
8778
8779 local cleanVehicle = NativeUI.CreateItem("Clean Vehicle", "Make your vehicle clean.")
8780 cleanVehicle.Activated = function(ParentMenu, SelectedItem) FiveM.CleanVehicle(GetVehiclePedIsIn(GetPlayerPed(-1))) end
8781 VehicleOptionsMenu:AddItem(cleanVehicle)
8782
8783 local changeVehiclePlate = NativeUI.CreateItem("Set License Plate Text", "Enter a custom license plate for your vehicle.")
8784 changeVehiclePlate.Activated = function(ParentMenu, SelectedItem)
8785 if IsPedInAnyVehicle(GetPlayerPed(-1)) then
8786 local playerVeh = GetVehiclePedIsIn(GetPlayerPed(-1), true)
8787 local result = FiveM.GetKeyboardInput("Enter the plate license you want", "", 8)
8788 if result then SetVehicleNumberPlateText(playerVeh, result) end
8789 else
8790 FiveM.Notify("You must be in a ~r~vehicle ~w~to use this !", NotificationType.Error)
8791 end end
8792 VehicleOptionsMenu:AddItem(changeVehiclePlate)
8793
8794 local noFall = NativeUI.CreateCheckboxItem("Bike No-Fall", Enable_NoFall, "Enable no-fall for the bike.")
8795 noFall.CheckboxEvent = function(menu, item, enabled)
8796 Enable_NoFall = enabled
8797 SetPedCanBeKnockedOffVehicle(GetPlayerPed(-1), Enable_NoFall and 1 or 0) end
8798 VehicleOptionsMenu:AddItem(noFall)
8799
8800 local vehicleGodmode = NativeUI.CreateCheckboxItem("Vehicle Godmode", Enable_NoFall, "Enable vehicle godmode.")
8801 vehicleGodmode.CheckboxEvent = function(menu, item, enabled) Enable_VehicleGodMode = enabled end
8802 VehicleOptionsMenu:AddItem(vehicleGodmode)
8803 end
8804
8805 local function AddTriggerOptionsMenu(menu)
8806 local TriggerOptionsMenu = (HoaxMenuPool:AddSubMenu(menu, "ESX Triggers"))
8807 TriggerOptionsMenu.Item:RightLabel("→→")
8808 TriggerOptionsMenu = TriggerOptionsMenu.SubMenu
8809
8810 local ESXBoss = NativeUI.CreateListItem("Open Boss Menu", Jobs, 1)
8811 ESXBoss.OnListSelected = function(menu, item, index)
8812 FiveM.TriggerCustomEvent(false, 'esx_society:openBossMenu', Jobs.Type[ESXBoss:IndexToItem(index)], function(data, menu) HoaxMenuPool:CloseAllMenus() end) end
8813 TriggerOptionsMenu:AddItem(ESXBoss);
8814 FiveM.SetResourceLocked('esx_society', ESXBoss);
8815 Citizen.CreateThread(function() while ShowMenu do ESXBoss:Enabled(Enable_BossMenu); Citizen.Wait(0); end end)
8816
8817 local ESXMoney = NativeUI.CreateListItem("Generate Job Paycheck", Jobs.Money, 1);
8818 ESXMoney.OnListSelected = function(menu, item, index)
8819 local money = FiveM.GetKeyboardInput("Enter the amount of money for paycheck", "", 10)
8820 FiveM.TriggerCustomEvent(true, Jobs.Money.Value[index]..':pay', tonumber(money)) end
8821 TriggerOptionsMenu:AddItem(ESXMoney);
8822
8823 local ESXLicense = NativeUI.CreateItem("~y~ESX: ~s~Driving License", "Give yourself all driving license!");
8824 ESXLicense.Activated = function(ParentMenu, SelectedItem)
8825 FiveM.TriggerCustomEvent(true, 'esx_dmvschool:addLicense', dmv)
8826 FiveM.TriggerCustomEvent(true, 'esx_dmvschool:addLicense', drive)
8827 FiveM.TriggerCustomEvent(true, 'esx_dmvschool:addLicense', drive_bike)
8828 FiveM.TriggerCustomEvent(true, 'esx_dmvschool:addLicense', drive_truck) end
8829 TriggerOptionsMenu:AddItem(ESXLicense);
8830 FiveM.SetResourceLocked('esx_dmvschool', ESXLicense);
8831
8832 local ESXSpawnJobItem = NativeUI.CreateListItem("~y~ESX:~s~ Choose Spawning Item", Jobs.Item, 1, "Spawn this Item.");
8833 ESXSpawnJobItem.OnListSelected = function(menu, list, index)
8834 local item = list:IndexToItem(index)
8835 local JobDB = Jobs.ItemDatabase[item];
8836 if type(JobDB) == "table" then
8837 Citizen.CreateThread(function()
8838 for key, value in pairs(JobDB) do
8839 local ItemRequired = Jobs.ItemRequires[key];
8840 local ItemData = {
8841 {
8842 name = key, db_name = value, time = 100, max = 100, add = 10, remove = 10, drop = 100,
8843 requires = ItemRequired and JobDB[ItemRequired] or "nothing",
8844 requires_name = ItemRequired and ItemRequired or "Nothing"
8845 }
8846 }
8847 Citizen.CreateThread(function()
8848 FiveM.TriggerCustomEvent(true, 'esx_jobs:startWork', ItemData)
8849 Wait(1000)
8850 FiveM.TriggerCustomEvent(true, 'esx_jobs:stopWork')
8851 end)
8852 Wait(3000)
8853 end
8854 end)
8855 else
8856 local ItemRequired = Jobs.ItemRequires[item];
8857 local ItemData = {
8858 {
8859 name = item, db_name = JobDB, time = 100, max = 100, add = 10, remove = 10, drop = 100,
8860 requires = ItemRequired and Jobs.ItemDatabase[ItemRequired] or "nothing",
8861 requires_name = ItemRequired and ItemRequired or "Nothing"
8862 }
8863 }
8864 Citizen.CreateThread(function()
8865 FiveM.TriggerCustomEvent(true, 'esx_jobs:startWork', ItemData)
8866 Wait(100)
8867 FiveM.TriggerCustomEvent(true, 'esx_jobs:stopWork')
8868 end)
8869 end
8870 end
8871 TriggerOptionsMenu:AddItem(ESXSpawnJobItem)
8872 FiveM.SetResourceLocked('esx_jobs', ESXSpawnJobItem)
8873 end
8874
8875 local function AddWorldOptionsMenu(menu)
8876 local WorldOptionsMenu = (HoaxMenuPool:AddSubMenu(menu, "World Options"))
8877 WorldOptionsMenu.Item:RightLabel("→→")
8878 WorldOptionsMenu = WorldOptionsMenu.SubMenu
8879
8880 local ESPOptionsMenu = (HoaxMenuPool:AddSubMenu(WorldOptionsMenu, "Extra-Sensory Perception (ESP)"))
8881 ESPOptionsMenu.Item:RightLabel("→→")
8882 ESPOptionsMenu = ESPOptionsMenu.SubMenu
8883 --[[ ESPOptionsMenu ]] do
8884 local esp = NativeUI.CreateCheckboxItem("ESP", ShowEsp, "Master Switch.")
8885 esp.CheckboxEvent = function(menu, item, enabled) ShowEsp = enabled end
8886 ESPOptionsMenu:AddItem(esp)
8887
8888 local espInfo = NativeUI.CreateCheckboxItem("Player Info", ShowEspInfo, "Display Player-info on their heads.")
8889 espInfo.CheckboxEvent = function(menu, item, enabled) ShowEspInfo = enabled end
8890 ESPOptionsMenu:AddItem(espInfo)
8891
8892 local espOutline = NativeUI.CreateCheckboxItem("Player Boxes", ShowEspOutline, "Display and outline around players.")
8893 espOutline.CheckboxEvent = function(menu, item, enabled) ShowEspOutline = enabled end
8894 ESPOptionsMenu:AddItem(espOutline)
8895
8896 local espLines = NativeUI.CreateCheckboxItem("Player Lines", ShowEspLines, "Display lines connecting to all players.")
8897 espLines.CheckboxEvent = function(menu, item, enabled) ShowEspLines = enabled end
8898 ESPOptionsMenu:AddItem(espLines)
8899
8900 local espWantedLevel = NativeUI.CreateCheckboxItem("Wanted Levels", ShowWantedLevel, "Display Player wanted level on their heads.")
8901 espWantedLevel.CheckboxEvent = function(menu, item, enabled) ShowWantedLevel = enabled end
8902 ESPOptionsMenu:AddItem(espWantedLevel)
8903
8904 local espHeadSprites = NativeUI.CreateCheckboxItem("Player Names", ShowHeadSprites, "Display Player Names on their heads.")
8905 espHeadSprites.CheckboxEvent = function(menu, item, enabled) ShowHeadSprites = enabled end
8906 ESPOptionsMenu:AddItem(espHeadSprites)
8907 end
8908
8909 local radar = NativeUI.CreateCheckboxItem("Enable Extended Radar", ShowExtendedRadar, "Enable mini-map (radar).")
8910 radar.CheckboxEvent = function(menu, item, enabled) ShowExtendedRadar = enabled end
8911 WorldOptionsMenu:AddItem(radar)
8912
8913 local playerBlips = NativeUI.CreateCheckboxItem("Show Player Blips", ShowPlayerBlips, "Shows blips on the map for all players.")
8914 playerBlips.CheckboxEvent = function(menu, item, enabled) ShowPlayerBlips = enabled end
8915 WorldOptionsMenu:AddItem(playerBlips)
8916
8917 local crosshair = NativeUI.CreateCheckboxItem("Enable Crosshair", ShowCrosshair, "Enable crosshair for giving leathal damage.")
8918 crosshair.CheckboxEvent = function(menu, item, enabled) ShowCrosshair = enabled end
8919 WorldOptionsMenu:AddItem(crosshair)
8920 end
8921
8922 local function AddSettingOptionsMenu(menu)
8923 local SettingOptionsMenu = (HoaxMenuPool:AddSubMenu(menu, "Menu Settings"))
8924 SettingOptionsMenu.Item:RightLabel("→→")
8925 SettingOptionsMenu = SettingOptionsMenu.SubMenu
8926
8927 local bossMenu = NativeUI.CreateCheckboxItem("Enable BossMenu", Enable_BossMenu, "Enable mini-map (radar).")
8928 bossMenu.CheckboxEvent = function(menu, item, enabled) Enable_BossMenu = enabled end
8929 SettingOptionsMenu:AddItem(bossMenu)
8930
8931 local disable = NativeUI.CreateItem("~r~Disable Menu", "Permanently Disable Menu!")
8932 disable:SetRightBadge(BadgeStyle.Alert)
8933 disable.Activated = function(ParentMenu, SelectedItem) ShowMenu = false end
8934 SettingOptionsMenu:AddItem(disable)
8935 end
8936
8937 AddPlayerOptionsMenu(HoaxMenu)
8938 AddOnlinePlayersMenu(HoaxMenu)
8939 AddTeleportMenu(HoaxMenu)
8940 AddWeaponOptionsMenu(HoaxMenu)
8941 AddVehicleOptionsMenu(HoaxMenu)
8942 AddTriggerOptionsMenu(HoaxMenu)
8943 AddWorldOptionsMenu(HoaxMenu)
8944 AddSettingOptionsMenu(HoaxMenu)
8945end
8946
8947HoaxMenuPool:MouseControlsEnabled(false)
8948HoaxMenuPool:MouseEdgeEnabled(false)
8949HoaxMenuPool:ControlDisablingEnabled(false)
8950
8951HoaxMenuPool:RefreshIndex()
8952
8953Citizen.CreateThread(function()
8954while ShowMenu do
8955 HoaxMenuPool:ProcessMenus()
8956 if IsDisabledControlJustPressed(0, 121) then
8957 HoaxMenuPool:RefreshIndex()
8958 if HoaxMenuPool:IsAnyMenuOpen() then
8959 HoaxMenuPool:CloseAllMenus()
8960 else
8961 HoaxMenu:Visible(true)
8962 end
8963 end
8964 Citizen.Wait(0)
8965end
8966end)
8967
8968RegisterCommand("killmenu", function(source, args, raw) ShowMenu = false end, false)