├── .github └── FUNDING.yml ├── .gitattributes ├── stream └── pablo.ytd ├── sqlcheme.sql ├── fxmanifest.lua ├── vendors └── RageUI │ ├── components │ ├── Rectangle.lua │ ├── Audio.lua │ ├── Sprite.lua │ ├── Screen.lua │ ├── Visual.lua │ └── Text.lua │ ├── menu │ ├── items │ │ ├── UISeparator.lua │ │ ├── UISliderHeritage.lua │ │ ├── UIProgress.lua │ │ ├── UIButton.lua │ │ ├── UIList.lua │ │ ├── UICheckBox.lua │ │ ├── UISlider.lua │ │ └── UISliderProgress.lua │ ├── panels │ │ ├── UIBoutonPanel.lua │ │ ├── UIPercentagePanel.lua │ │ ├── UIGridPanelHorizontal.lua │ │ ├── UIGridPanelVertical.lua │ │ ├── UIGridPanel.lua │ │ ├── UIColourPanel.lua │ │ └── UIStatisticsPanel.lua │ ├── windows │ │ └── UIHeritage.lua │ ├── elements │ │ ├── PanelColour.lua │ │ ├── ItemsBadge.lua │ │ └── ItemsColour.lua │ ├── Menu.lua │ └── MenuController.lua │ └── RMenu.lua ├── shared └── config.lua ├── server └── main.lua └── client └── main.lua /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: PABLO-1610 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /stream/pablo.ytd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pablo-1610/esx_cryptocurrencies/HEAD/stream/pablo.ytd -------------------------------------------------------------------------------- /sqlcheme.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `cryptos` ( 2 | `name` varchar(40) NOT NULL, 3 | `label` varchar(255) NOT NULL, 4 | `value` double NOT NULL 5 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 6 | 7 | ALTER TABLE `cryptos` 8 | ADD PRIMARY KEY (`name`); 9 | COMMIT; 10 | 11 | CREATE TABLE `cryptos_wallet` ( 12 | `identifier` varchar(80) NOT NULL, 13 | `wallet` text NOT NULL 14 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 15 | 16 | ALTER TABLE `cryptos_wallet` 17 | ADD PRIMARY KEY (`identifier`); 18 | COMMIT; 19 | -------------------------------------------------------------------------------- /fxmanifest.lua: -------------------------------------------------------------------------------- 1 | fx_version 'bodacious' 2 | game 'gta5' 3 | 4 | shared_scripts { 5 | "shared/*.lua" 6 | } 7 | 8 | server_scripts { 9 | "@mysql-async/lib/MySQL.lua", 10 | "server/*.lua" 11 | } 12 | 13 | client_scripts { 14 | "vendors/RageUI/RMenu.lua", 15 | "vendors/RageUI/menu/RageUI.lua", 16 | "vendors/RageUI/menu/Menu.lua", 17 | "vendors/RageUI/menu/MenuController.lua", 18 | "vendors/RageUI/components/*.lua", 19 | "vendors/RageUI/menu/elements/*.lua", 20 | "vendors/RageUI/menu/items/*.lua", 21 | "vendors/RageUI/menu/panels/*.lua", 22 | "vendors/RageUI/menu/windows/*.lua", 23 | 24 | "client/*.lua" 25 | } -------------------------------------------------------------------------------- /vendors/RageUI/components/Rectangle.lua: -------------------------------------------------------------------------------- 1 | ---RenderRectangle 2 | --- 3 | --- Reference : https://github.com/iTexZoz/NativeUILua_Reloaded/blob/master/UIElements/UIResRectangle.lua#L84 4 | --- 5 | ---@param X number 6 | ---@param Y number 7 | ---@param Width number 8 | ---@param Height number 9 | ---@param R number 10 | ---@param G number 11 | ---@param B number 12 | ---@param A number 13 | ---@return nil 14 | ---@public 15 | function RenderRectangle(X, Y, Width, Height, R, G, B, A) 16 | local X, Y, Width, Height = (tonumber(X) or 0) / 1920, (tonumber(Y) or 0) / 1080, (tonumber(Width) or 0) / 1920, (tonumber(Height) or 0) / 1080 17 | DrawRect(X + Width * 0.5, Y + Height * 0.5, Width, Height, tonumber(R) or 255, tonumber(G) or 255, tonumber(B) or 255, tonumber(A) or 255) 18 | end 19 | -------------------------------------------------------------------------------- /vendors/RageUI/components/Audio.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- Generated by EmmyLua(https://github.com/EmmyLua) 3 | --- Created by Dylan Malandain. 4 | --- DateTime: 24/07/2019 03:38 5 | --- 6 | 7 | 8 | ---PlaySound 9 | --- 10 | --- Reference : N/A 11 | --- 12 | ---@param Library string 13 | ---@param Sound string 14 | ---@param IsLooped boolean 15 | ---@return nil 16 | ---@public 17 | function RageUI.PlaySound(Library, Sound, IsLooped) 18 | local audioId 19 | if not IsLooped then 20 | PlaySoundFrontend(-1, Sound, Library, true) 21 | else 22 | if not audioId then 23 | Citizen.CreateThread(function() 24 | audioId = GetSoundId() 25 | PlaySoundFrontend(audioId, Sound, Library, true) 26 | Citizen.Wait(0.01) 27 | StopSound(audioId) 28 | ReleaseSoundId(audioId) 29 | audioId = nil 30 | end) 31 | end 32 | end 33 | end 34 | 35 | 36 | -------------------------------------------------------------------------------- /vendors/RageUI/components/Sprite.lua: -------------------------------------------------------------------------------- 1 | ---RenderSprite 2 | --- 3 | --- Reference : https://github.com/iTexZoz/NativeUILua_Reloaded/blob/master/UIElements/Sprite.lua#L90 4 | --- 5 | ---@param TextureDictionary string 6 | ---@param TextureName string 7 | ---@param X number 8 | ---@param Y number 9 | ---@param Width number 10 | ---@param Height number 11 | ---@param Heading number 12 | ---@param R number 13 | ---@param G number 14 | ---@param B number 15 | ---@param A number 16 | ---@return nil 17 | ---@public 18 | function RenderSprite(TextureDictionary, TextureName, X, Y, Width, Height, Heading, R, G, B, A) 19 | ---@type number 20 | local X, Y, Width, Height = (tonumber(X) or 0) / 1920, (tonumber(Y) or 0) / 1080, (tonumber(Width) or 0) / 1920, (tonumber(Height) or 0) / 1080 21 | 22 | if not HasStreamedTextureDictLoaded(TextureDictionary) then 23 | RequestStreamedTextureDict(TextureDictionary, true) 24 | end 25 | 26 | DrawSprite(TextureDictionary, TextureName, X + Width * 0.5, Y + Height * 0.5, Width, Height, Heading or 0, tonumber(R) or 255, tonumber(G) or 255, tonumber(B) or 255, tonumber(A) or 255) 27 | end -------------------------------------------------------------------------------- /vendors/RageUI/components/Screen.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- Generated by EmmyLua(https://github.com/EmmyLua) 3 | --- Created by Dylan Malandain. 4 | --- DateTime: 24/07/2019 03:38 5 | --- 6 | 7 | 8 | 9 | ---LoadingPrompt 10 | --- 11 | --- Reference : https://github.com/citizenfx/fivem/blob/master/code/client/clrcore/External/Screen.cs#L341 12 | --- 13 | ---@param loadingText string 14 | ---@param spinnerType number 15 | ---@return void 16 | function LoadingPrompt(loadingText, spinnerType) 17 | 18 | if IsLoadingPromptBeingDisplayed() then 19 | RemoveLoadingPrompt() 20 | end 21 | 22 | if (loadingText == nil) then 23 | BeginTextCommandBusyString(nil) 24 | else 25 | BeginTextCommandBusyString("STRING"); 26 | AddTextComponentSubstringPlayerName(loadingText); 27 | end 28 | 29 | EndTextCommandBusyString(spinnerType) 30 | end 31 | 32 | ---LoadingPromptHide 33 | --- 34 | --- Reference : https://github.com/citizenfx/fivem/blob/master/code/client/clrcore/External/Screen.cs#L361 35 | --- 36 | ---@return void 37 | function LoadingPromptHide() 38 | if IsLoadingPromptBeingDisplayed() then 39 | RemoveLoadingPrompt() 40 | end 41 | end 42 | 43 | 44 | -------------------------------------------------------------------------------- /shared/config.lua: -------------------------------------------------------------------------------- 1 | Config = { 2 | esxGetter = "esx:getSharedObject", 3 | webhook = "put your webhook here", 4 | webhook_mess_color = 8421504, 5 | blip = true, 6 | position = vector3(-64.09, -797.39, 44.23), 7 | debug = false, -- Console printing 8 | 9 | crypto = { 10 | maxValue = 1000000, 11 | minValue = 0, 12 | 13 | noChangeChance = function() 14 | return (math.random(1, 3) == 1) 15 | end, 16 | 17 | cryptoVariationCycle = 2, -- In seconds 18 | 19 | positiveMaxVariationValue = 100, 20 | negativeMaxVariationValue = -100 21 | } 22 | } 23 | 24 | validateCryptoValue = function(cryptoValue) 25 | return cryptoValue <= Config.crypto.maxValue and cryptoValue >= Config.crypto.minValue 26 | end 27 | 28 | alterCryptoValue = function(currentValue) 29 | value = currentValue 30 | local variation = math.random(Config.crypto.negativeMaxVariationValue, Config.crypto.positiveMaxVariationValue) 31 | local fakeValue = value + variation 32 | while not validateCryptoValue(fakeValue) do 33 | variation = math.random(Config.crypto.negativeMaxVariationValue, Config.crypto.positiveMaxVariationValue) 34 | fakeValue = value + variation 35 | end 36 | value = fakeValue 37 | return value, (variation > 0) 38 | end 39 | 40 | debug = function(text) 41 | if Config.debug then print(text) end 42 | end -------------------------------------------------------------------------------- /vendors/RageUI/menu/items/UISeparator.lua: -------------------------------------------------------------------------------- 1 | ---@type table 2 | local SettingsButton = { 3 | Rectangle = { Y = 0, Width = 431, Height = 38 }, 4 | Text = { X = 8, Y = 3, Scale = 0.33 }, 5 | } 6 | 7 | function RageUI.Separator(Label) 8 | local CurrentMenu = RageUI.CurrentMenu 9 | if CurrentMenu ~= nil then 10 | if CurrentMenu() then 11 | local Option = RageUI.Options + 1 12 | if CurrentMenu.Pagination.Minimum <= Option and CurrentMenu.Pagination.Maximum >= Option then 13 | if (Label ~= nil) then 14 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + (CurrentMenu.WidthOffset * 2.5 ~= 0 and CurrentMenu.WidthOffset * 2.5 or 200), CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 245, 245, 245, 255, 1) 15 | end 16 | RageUI.ItemOffset = RageUI.ItemOffset + SettingsButton.Rectangle.Height 17 | if (CurrentMenu.Index == Option) then 18 | if (RageUI.LastControl) then 19 | CurrentMenu.Index = Option - 1 20 | if (CurrentMenu.Index < 1) then 21 | CurrentMenu.Index = RageUI.CurrentMenu.Options 22 | end 23 | else 24 | CurrentMenu.Index = Option + 1 25 | end 26 | end 27 | end 28 | RageUI.Options = RageUI.Options + 1 29 | end 30 | end 31 | end 32 | 33 | -------------------------------------------------------------------------------- /vendors/RageUI/menu/panels/UIBoutonPanel.lua: -------------------------------------------------------------------------------- 1 | local TextPanels = { 2 | Background = { Dictionary = "commonmenu", Texture = "gradient_bgd", Y = 4, Width = 431, Height = 42 }, 3 | Text = { 4 | Left = { X = 8, Y = 10, Scale = 0.35 }, 5 | Right = { X = 8, Y = 10, Scale = 0.35 }, 6 | }, 7 | } 8 | 9 | ---BoutonPanel 10 | ---@param LeftText string 11 | ---@param RightText string 12 | ---@public 13 | function RageUI.BoutonPanel(LeftText, RightText, Index) 14 | local CurrentMenu = RageUI.CurrentMenu 15 | if CurrentMenu ~= nil then 16 | local leftTextSize = MeasureStringWidth(LeftText) 17 | if CurrentMenu() and (Index == nil or (CurrentMenu.Index == Index)) then 18 | RenderRectangle(CurrentMenu.X, CurrentMenu.Y + TextPanels.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + (RageUI.StatisticPanelCount * 42), TextPanels.Background.Width + CurrentMenu.WidthOffset, TextPanels.Background.Height, 0, 0, 0, 170) 19 | RenderText(LeftText or "", CurrentMenu.X + TextPanels.Text.Left.X, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + TextPanels.Text.Left.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, TextPanels.Text.Left.Scale, 245, 245, 245, 255, 0) 20 | RenderText(RightText or "", CurrentMenu.X + TextPanels.Background.Width + CurrentMenu.WidthOffset - leftTextSize, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + TextPanels.Text.Left.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, TextPanels.Text.Left.Scale, 245, 245, 245, 255, 2) 21 | RageUI.StatisticPanelCount = RageUI.StatisticPanelCount + 1 22 | end 23 | end 24 | end -------------------------------------------------------------------------------- /vendors/RageUI/RMenu.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- Generated by EmmyLua(https://github.com/EmmyLua) 3 | --- Created by Dylan Malandain. 4 | --- DateTime: 29/10/2019 02:40 5 | --- 6 | 7 | ---@type table 8 | RageUI = {} 9 | 10 | ---@type table 11 | RMenu = setmetatable({}, RMenu) 12 | 13 | ---@type table 14 | local TotalMenus = {} 15 | 16 | ---Add 17 | ---@param Type string 18 | ---@param Name string 19 | ---@param Menu table 20 | ---@return _G 21 | ---@public 22 | function RMenu.Add(Type, Name, Menu) 23 | if RMenu[Type] ~= nil then 24 | RMenu[Type][Name] = { 25 | Menu = Menu 26 | } 27 | else 28 | RMenu[Type] = {} 29 | RMenu[Type][Name] = { 30 | Menu = Menu 31 | } 32 | end 33 | 34 | table.insert(TotalMenus, Menu) 35 | end 36 | 37 | ---Get 38 | ---@param Type string 39 | ---@param Name string 40 | ---@return table 41 | ---@public 42 | function RMenu:Get(Type, Name) 43 | if self[Type] ~= nil and self[Type][Name] ~= nil then 44 | return self[Type][Name].Menu 45 | end 46 | end 47 | 48 | ---GetType 49 | ---@param Type string 50 | ---@return table 51 | ---@public 52 | function RMenu:GetType(Type) 53 | if self[Type] ~= nil then 54 | return self[Type] 55 | end 56 | end 57 | 58 | ---Settings 59 | ---@param Type string 60 | ---@param Name string 61 | ---@param Settings string 62 | ---@param Value any optional 63 | ---@return void 64 | ---@public 65 | function RMenu:Settings(Type, Name, Settings, Value) 66 | if Value ~= nil then 67 | self[Type][Name][Settings] = Value 68 | else 69 | return self[Type][Name][Settings] 70 | end 71 | end 72 | 73 | 74 | ---Delete 75 | ---@param Type string 76 | ---@param Name string 77 | ---@return void 78 | ---@public 79 | function RMenu:Delete(Type, Name) 80 | self[Type][Name] = nil 81 | collectgarbage() 82 | end 83 | 84 | ---DeleteType 85 | ---@param Type string 86 | ---@return void 87 | ---@public 88 | function RMenu:DeleteType(Type) 89 | self[Type] = nil 90 | collectgarbage() 91 | end 92 | -------------------------------------------------------------------------------- /vendors/RageUI/menu/windows/UIHeritage.lua: -------------------------------------------------------------------------------- 1 | ---@type table 2 | local Heritage = { 3 | Background = { Dictionary = "pause_menu_pages_char_mom_dad", Texture = "mumdadbg", Width = 431, Height = 228 }, 4 | Mum = { Dictionary = "char_creator_portraits", X = 25, Width = 228, Height = 228 }, 5 | Dad = { Dictionary = "char_creator_portraits", X = 195, Width = 228, Height = 228 }, 6 | } 7 | 8 | ---HeritageWindow 9 | ---@param Mum number 10 | ---@param Dad number 11 | ---@return nil 12 | ---@public 13 | function RageUI.HeritageWindow(Mum, Dad) 14 | 15 | ---@type table 16 | local CurrentMenu = RageUI.CurrentMenu; 17 | 18 | if CurrentMenu ~= nil then 19 | if CurrentMenu() then 20 | 21 | if Mum < 0 or Mum > 21 then 22 | Mum = 0 23 | end 24 | if Dad < 0 or Dad > 23 then 25 | Dad = 0 26 | end 27 | if Mum == 21 then 28 | Mum = "special_female_" .. (tonumber(string.sub(Mum, 2, 2)) - 1) 29 | else 30 | Mum = "female_" .. Mum 31 | end 32 | if Dad >= 21 then 33 | Dad = "special_male_" .. (tonumber(string.sub(Dad, 2, 2)) - 1) 34 | else 35 | Dad = "male_" .. Dad 36 | end 37 | 38 | RenderSprite(Heritage.Background.Dictionary, Heritage.Background.Texture, CurrentMenu.X, CurrentMenu.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Heritage.Background.Width + (CurrentMenu.WidthOffset / 1), Heritage.Background.Height) 39 | RenderSprite(Heritage.Dad.Dictionary, Dad, CurrentMenu.X + Heritage.Dad.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Heritage.Dad.Width, Heritage.Dad.Height) 40 | RenderSprite(Heritage.Mum.Dictionary, Mum, CurrentMenu.X + Heritage.Mum.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Heritage.Mum.Width, Heritage.Mum.Height) 41 | 42 | RageUI.ItemOffset = RageUI.ItemOffset + Heritage.Background.Height 43 | end 44 | end 45 | end 46 | 47 | -------------------------------------------------------------------------------- /vendors/RageUI/menu/elements/PanelColour.lua: -------------------------------------------------------------------------------- 1 | RageUI.PanelColour = { 2 | HairCut = { 3 | { 22, 19, 19 }, -- 0 4 | { 30, 28, 25 }, -- 1 5 | { 76, 56, 45 }, -- 2 6 | { 69, 34, 24 }, -- 3 7 | { 123, 59, 31 }, -- 4 8 | { 149, 68, 35 }, -- 5 9 | { 165, 87, 50 }, -- 6 10 | { 175, 111, 72 }, -- 7 11 | { 159, 105, 68 }, -- 8 12 | { 198, 152, 108 }, -- 9 13 | { 213, 170, 115 }, -- 10 14 | { 223, 187, 132 }, -- 11 15 | { 202, 164, 110 }, -- 12 16 | { 238, 204, 130 }, -- 13 17 | { 229, 190, 126 }, -- 14 18 | { 250, 225, 167 }, -- 15 19 | { 187, 140, 96 }, -- 16 20 | { 163, 92, 60 }, -- 17 21 | { 144, 52, 37 }, -- 18 22 | { 134, 21, 17 }, -- 19 23 | { 164, 24, 18 }, -- 20 24 | { 195, 33, 24 }, -- 21 25 | { 221, 69, 34 }, -- 22 26 | { 229, 71, 30 }, -- 23 27 | { 208, 97, 56 }, -- 24 28 | { 113, 79, 38 }, -- 25 29 | { 132, 107, 95 }, -- 26 30 | { 185, 164, 150 }, -- 27 31 | { 218, 196, 180 }, -- 28 32 | { 247, 230, 217 }, -- 29 33 | { 102, 72, 93 }, -- 30 34 | { 162, 105, 138 }, -- 31 35 | { 171, 174, 11 }, -- 32 36 | { 239, 61, 200 }, -- 33 37 | { 255, 69, 152 }, -- 34 38 | { 255, 178, 191 }, -- 35 39 | { 12, 168, 146 }, -- 36 40 | { 8, 146, 165 }, -- 37 41 | { 11, 82, 134 }, -- 38 42 | { 118, 190, 117 }, -- 39 43 | { 52, 156, 104 }, -- 40 44 | { 22, 86, 85 }, -- 41 45 | { 152, 177, 40 }, -- 42 46 | { 127, 162, 23 }, -- 43 47 | { 241, 200, 98 }, -- 44 48 | { 238, 178, 16 }, -- 45 49 | { 224, 134, 14 }, -- 46 50 | { 247, 157, 15 }, -- 47 51 | { 243, 143, 16 }, -- 48 52 | { 231, 70, 15 }, -- 49 53 | { 255, 101, 21 }, -- 50 54 | { 254, 91, 34 }, -- 51 55 | { 252, 67, 21 }, -- 52 56 | { 196, 12, 15 }, -- 53 57 | { 143, 10, 14 }, -- 54 58 | { 44, 27, 22 }, -- 55 59 | { 80, 51, 37 }, -- 56 60 | { 98, 54, 37 }, -- 57 61 | { 60, 31, 24 }, -- 58 62 | { 69, 43, 32 }, -- 59 63 | { 8, 10, 14 }, -- 60 64 | { 212, 185, 158 }, -- 61 65 | { 212, 185, 158 }, -- 62 66 | { 213, 170, 115 }, -- 63 67 | }, 68 | } 69 | 70 | -------------------------------------------------------------------------------- /vendors/RageUI/components/Visual.lua: -------------------------------------------------------------------------------- 1 | ---- event from server to show notification 2 | RegisterNetEvent("RageUI:Popup") 3 | AddEventHandler("RageUI:Popup", function(array) 4 | RageUI.Popup(array) 5 | end) 6 | 7 | ---Popup 8 | ---@param array table 9 | ---@public 10 | function RageUI.Popup(array) 11 | ClearPrints() 12 | if (array.colors == nil) then 13 | SetNotificationBackgroundColor(140) 14 | else 15 | SetNotificationBackgroundColor(array.colors) 16 | end 17 | SetNotificationTextEntry("STRING") 18 | if (array.message == nil) then 19 | error("Missing arguments, message") 20 | else 21 | AddTextComponentString(tostring(array.message)) 22 | end 23 | DrawNotification(false, true) 24 | if (array.sound ~= nil) then 25 | if (array.sound.audio_name ~= nil) then 26 | if (array.sound.audio_ref ~= nil) then 27 | PlaySoundFrontend(-1, array.sound.audio_name, array.sound.audio_ref, true) 28 | else 29 | error("Missing arguments, audio_ref") 30 | end 31 | else 32 | error("Missing arguments, audio_name") 33 | end 34 | end 35 | end 36 | 37 | 38 | ---PopupChar 39 | ---@param array table 40 | ---@public 41 | function RageUI.PopupChar(array) 42 | if (array.colors == nil) then 43 | SetNotificationBackgroundColor(140) 44 | else 45 | SetNotificationBackgroundColor(array.colors) 46 | end 47 | SetNotificationTextEntry("STRING") 48 | if (array.message == nil) then 49 | error("Missing arguments, message") 50 | else 51 | AddTextComponentString(tostring(array.message)) 52 | end 53 | if (array.request_stream_texture_dics ~= nil) then 54 | RequestStreamedTextureDict(array.request_stream_texture_dics) 55 | end 56 | if (array.picture ~= nil) then 57 | if (array.iconTypes == 1) or (array.iconTypes == 2) or (array.iconTypes == 3) or (array.iconTypes == 7) or (array.iconTypes == 8) or (array.iconTypes == 9) then 58 | SetNotificationMessage(tostring(array.picture), tostring(array.picture), true, array.iconTypes, array.sender, array.title) 59 | else 60 | SetNotificationMessage(tostring(array.picture), tostring(array.picture), true, 4, array.sender, array.title) 61 | end 62 | else 63 | if (array.iconTypes == 1) or (array.iconTypes == 2) or (array.iconTypes == 3) or (array.iconTypes == 7) or (array.iconTypes == 8) or (array.iconTypes == 9) then 64 | SetNotificationMessage('CHAR_ALL_PLAYERS_CONF', 'CHAR_ALL_PLAYERS_CONF', true, array.iconTypes, array.sender, array.title) 65 | else 66 | SetNotificationMessage('CHAR_ALL_PLAYERS_CONF', 'CHAR_ALL_PLAYERS_CONF', true, 4, array.sender, array.title) 67 | end 68 | end 69 | if (array.sound ~= nil) then 70 | if (array.sound.audio_name ~= nil) then 71 | if (array.sound.audio_ref ~= nil) then 72 | PlaySoundFrontend(-1, array.sound.audio_name, array.sound.audio_ref, true) 73 | else 74 | error("Missing arguments, audio_ref") 75 | end 76 | else 77 | error("Missing arguments, audio_name") 78 | end 79 | end 80 | DrawNotification(false, true) 81 | end 82 | 83 | ---Text 84 | ---@param array table 85 | ---@public 86 | function RageUI.Text(array) 87 | ClearPrints() 88 | SetTextEntry_2("STRING") 89 | if (array.message ~= nil) then 90 | AddTextComponentString(tostring(array.message)) 91 | else 92 | error("Missing arguments, message") 93 | end 94 | if (array.time_display ~= nil) then 95 | DrawSubtitleTimed(tonumber(array.time_display), 1) 96 | else 97 | DrawSubtitleTimed(10, 1) 98 | end 99 | if (array.sound ~= nil) then 100 | if (array.sound.audio_name ~= nil) then 101 | if (array.sound.audio_ref ~= nil) then 102 | PlaySoundFrontend(-1, array.sound.audio_name, array.sound.audio_ref, true) 103 | else 104 | error("Missing arguments, audio_ref") 105 | end 106 | else 107 | error("Missing arguments, audio_name") 108 | end 109 | end 110 | end 111 | -------------------------------------------------------------------------------- /vendors/RageUI/menu/panels/UIPercentagePanel.lua: -------------------------------------------------------------------------------- 1 | local Percentage = { 2 | Background = { Dictionary = "commonmenu", Texture = "gradient_bgd", Y = 4, Width = 431, Height = 76 }, 3 | Bar = { X = 9, Y = 50, Width = 413, Height = 10 }, 4 | Text = { 5 | Left = { X = 25, Y = 15, Scale = 0.35 }, 6 | Middle = { X = 215.5, Y = 15, Scale = 0.35 }, 7 | Right = { X = 398, Y = 15, Scale = 0.35 }, 8 | }, 9 | } 10 | 11 | ---PercentagePanel 12 | ---@param Percent number 13 | ---@param HeaderText string 14 | ---@param MinText string 15 | ---@param MaxText string 16 | ---@param Callback function 17 | ---@param Index number 18 | ---@return nil 19 | ---@public 20 | function RageUI.PercentagePanel(Percent, HeaderText, MinText, MaxText, Callback, Index) 21 | local CurrentMenu = RageUI.CurrentMenu 22 | 23 | if CurrentMenu ~= nil then 24 | if CurrentMenu() and (Index == nil or (CurrentMenu.Index == Index)) then 25 | 26 | ---@type boolean 27 | local Hovered = RageUI.IsMouseInBounds(CurrentMenu.X + Percentage.Bar.X + CurrentMenu.SafeZoneSize.X, CurrentMenu.Y + Percentage.Bar.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset - 4, Percentage.Bar.Width + CurrentMenu.WidthOffset, Percentage.Bar.Height + 8) 28 | 29 | ---@type boolean 30 | local Selected = false 31 | 32 | ---@type number 33 | local Progress = Percentage.Bar.Width 34 | 35 | if Percent < 0.0 then 36 | Percent = 0.0 37 | elseif Percent > 1.0 then 38 | Percent = 1.0 39 | end 40 | 41 | Progress = Progress * Percent 42 | 43 | RenderSprite(Percentage.Background.Dictionary, Percentage.Background.Texture, CurrentMenu.X, CurrentMenu.Y + Percentage.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Percentage.Background.Width + CurrentMenu.WidthOffset, Percentage.Background.Height) 44 | RenderRectangle(CurrentMenu.X + Percentage.Bar.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Percentage.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Percentage.Bar.Width, Percentage.Bar.Height, 87, 87, 87, 255) 45 | RenderRectangle(CurrentMenu.X + Percentage.Bar.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Percentage.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Progress, Percentage.Bar.Height, 245, 245, 245, 255) 46 | 47 | RenderText(HeaderText or "Opacity", CurrentMenu.X + Percentage.Text.Middle.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Percentage.Text.Middle.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Percentage.Text.Middle.Scale, 245, 245, 245, 255, 1) 48 | RenderText(MinText or "0%", CurrentMenu.X + Percentage.Text.Left.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Percentage.Text.Left.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Percentage.Text.Left.Scale, 245, 245, 245, 255, 1) 49 | RenderText(MaxText or "100%", CurrentMenu.X + Percentage.Text.Right.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Percentage.Text.Right.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Percentage.Text.Right.Scale, 245, 245, 245, 255, 1) 50 | 51 | if Hovered then 52 | if IsDisabledControlPressed(0, 24) then 53 | Selected = true 54 | 55 | Progress = math.round(GetControlNormal(0, 239) * 1920) - CurrentMenu.SafeZoneSize.X - (CurrentMenu.X + Percentage.Bar.X + (CurrentMenu.WidthOffset / 2)) 56 | 57 | if Progress < 0 then 58 | Progress = 0 59 | elseif Progress > (Percentage.Bar.Width) then 60 | Progress = Percentage.Bar.Width 61 | end 62 | 63 | Percent = math.round(Progress / Percentage.Bar.Width, 2) 64 | end 65 | end 66 | 67 | RageUI.ItemOffset = RageUI.ItemOffset + Percentage.Background.Height + Percentage.Background.Y 68 | 69 | if Hovered and Selected then 70 | local Audio = RageUI.Settings.Audio 71 | RageUI.PlaySound(Audio[Audio.Use].Slider.audioName, Audio[Audio.Use].Slider.audioRef, true) 72 | end 73 | 74 | Callback(Hovered, Selected, Percent) 75 | end 76 | end 77 | end 78 | -------------------------------------------------------------------------------- /vendors/RageUI/menu/panels/UIGridPanelHorizontal.lua: -------------------------------------------------------------------------------- 1 | local GridPanelHorizontal = { 2 | Background = { Dictionary = "commonmenu", Texture = "gradient_bgd", Y = 4, Width = 431, Height = 275 }, 3 | Grid = { Dictionary = "RageUI", Texture = "horizontal_grid", X = 115.5, Y = 47.5, Width = 200, Height = 200 }, 4 | Circle = { Dictionary = "mpinventory", Texture = "in_world_circle", X = 115.5, Y = 47.5, Width = 20, Height = 20 }, 5 | Text = { 6 | Left = { X = 57.75, Y = 130, Scale = 0.35 }, 7 | Right = { X = 373.25, Y = 130, Scale = 0.35 }, 8 | }, 9 | } 10 | 11 | ---GridPanelVertical 12 | ---@param X number 13 | ---@param TopText string 14 | ---@param BottomText string 15 | ---@param LeftText string 16 | ---@param RightText string 17 | ---@param Callback table 18 | ---@param Index number 19 | ---@return table 20 | ---@public 21 | function RageUI.GridPanelHorizontal(X, LeftText, RightText, Callback, Index) 22 | local CurrentMenu = RageUI.CurrentMenu 23 | if CurrentMenu ~= nil then 24 | if CurrentMenu() and (Index == nil or (CurrentMenu.Index == Index)) then 25 | 26 | ---@type boolean 27 | local Hovered = RageUI.IsMouseInBounds(CurrentMenu.X + GridPanelHorizontal.Grid.X + CurrentMenu.SafeZoneSize.X + 20, CurrentMenu.Y + GridPanelHorizontal.Grid.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + 20, GridPanelHorizontal.Grid.Width + CurrentMenu.WidthOffset - 40, GridPanelHorizontal.Grid.Height - 40) 28 | 29 | ---@type boolean 30 | local Selected = false 31 | 32 | ---@type number 33 | local CircleX = CurrentMenu.X + GridPanelHorizontal.Grid.X + (CurrentMenu.WidthOffset / 2) + 20 34 | 35 | ---@type number 36 | local CircleY = CurrentMenu.Y + GridPanelHorizontal.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + 20 37 | 38 | if X < 0.0 or X > 1.0 then 39 | X = 0.0 40 | end 41 | 42 | local Y = 0.5 43 | 44 | CircleX = CircleX + ((GridPanelHorizontal.Grid.Width - 40) * X) - (GridPanelHorizontal.Circle.Width / 2) 45 | CircleY = CircleY + ((GridPanelHorizontal.Grid.Height - 40) * Y) - (GridPanelHorizontal.Circle.Height / 2) 46 | 47 | RenderSprite(GridPanelHorizontal.Background.Dictionary, GridPanelHorizontal.Background.Texture, CurrentMenu.X, CurrentMenu.Y + GridPanelHorizontal.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, GridPanelHorizontal.Background.Width + CurrentMenu.WidthOffset, GridPanelHorizontal.Background.Height) 48 | RenderSprite(GridPanelHorizontal.Grid.Dictionary, GridPanelHorizontal.Grid.Texture, CurrentMenu.X + GridPanelHorizontal.Grid.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + GridPanelHorizontal.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, GridPanelHorizontal.Grid.Width, GridPanelHorizontal.Grid.Height) 49 | RenderSprite(GridPanelHorizontal.Circle.Dictionary, GridPanelHorizontal.Circle.Texture, CircleX, CircleY, GridPanelHorizontal.Circle.Width, GridPanelHorizontal.Circle.Height) 50 | 51 | RenderText(LeftText or "", CurrentMenu.X + GridPanelHorizontal.Text.Left.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + GridPanelHorizontal.Text.Left.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, GridPanelHorizontal.Text.Left.Scale, 245, 245, 245, 255, 1) 52 | RenderText(RightText or "", CurrentMenu.X + GridPanelHorizontal.Text.Right.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + GridPanelHorizontal.Text.Right.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, GridPanelHorizontal.Text.Right.Scale, 245, 245, 245, 255, 1) 53 | 54 | if Hovered then 55 | if IsDisabledControlPressed(0, 24) then 56 | Selected = true 57 | 58 | CircleX = math.round(GetControlNormal(0, 239) * 1920) - CurrentMenu.SafeZoneSize.X - (GridPanelHorizontal.Circle.Width / 2) 59 | 60 | if CircleX > (CurrentMenu.X + GridPanelHorizontal.Grid.X + (CurrentMenu.WidthOffset / 2) + 20 + GridPanelHorizontal.Grid.Width - 40) then 61 | CircleX = CurrentMenu.X + GridPanelHorizontal.Grid.X + (CurrentMenu.WidthOffset / 2) + 20 + GridPanelHorizontal.Grid.Width - 40 62 | elseif CircleX < (CurrentMenu.X + GridPanelHorizontal.Grid.X + 20 - (GridPanelHorizontal.Circle.Width / 2)) then 63 | CircleX = CurrentMenu.X + GridPanelHorizontal.Grid.X + 20 - (GridPanelHorizontal.Circle.Width / 2) 64 | end 65 | 66 | X = math.round((CircleX - (CurrentMenu.X + GridPanelHorizontal.Grid.X + (CurrentMenu.WidthOffset / 2) + 20) + (GridPanelHorizontal.Circle.Width / 2)) / (GridPanelHorizontal.Grid.Width - 40), 2) 67 | if X > 1.0 then 68 | X = 1.0 69 | end 70 | end 71 | end 72 | RageUI.ItemOffset = RageUI.ItemOffset + GridPanelHorizontal.Background.Height + GridPanelHorizontal.Background.Y 73 | if Hovered and Selected then 74 | local Audio = RageUI.Settings.Audio 75 | RageUI.PlaySound(Audio[Audio.Use].Slider.audioName, Audio[Audio.Use].Slider.audioRef, true) 76 | end 77 | Callback(Hovered, Selected, X) 78 | end 79 | end 80 | end 81 | 82 | -------------------------------------------------------------------------------- /vendors/RageUI/menu/panels/UIGridPanelVertical.lua: -------------------------------------------------------------------------------- 1 | local GridPanelVertical = { 2 | Background = { Dictionary = "commonmenu", Texture = "gradient_bgd", Y = 4, Width = 431, Height = 275 }, 3 | Grid = { Dictionary = "RageUI", Texture = "vertical_grid", X = 115.5, Y = 47.5, Width = 200, Height = 200 }, 4 | Circle = { Dictionary = "mpinventory", Texture = "in_world_circle", X = 115.5, Y = 47.5, Width = 20, Height = 20 }, 5 | Text = { 6 | Top = { X = 215.5, Y = 15, Scale = 0.35 }, 7 | Bottom = { X = 215.5, Y = 250, Scale = 0.35 }, 8 | }, 9 | } 10 | 11 | ---GridPanelVertical 12 | ---@param Y number 13 | ---@param TopText string 14 | ---@param BottomText string 15 | ---@param Callback table 16 | ---@param Index number 17 | ---@return table 18 | ---@public 19 | function RageUI.GridPanelVertical(Y, TopText, BottomText, Callback, Index) 20 | local CurrentMenu = RageUI.CurrentMenu 21 | if CurrentMenu ~= nil then 22 | if CurrentMenu() and (Index == nil or (CurrentMenu.Index == Index)) then 23 | 24 | ---@type boolean 25 | local Hovered = RageUI.IsMouseInBounds(CurrentMenu.X + GridPanelVertical.Grid.X + CurrentMenu.SafeZoneSize.X + 20, CurrentMenu.Y + GridPanelVertical.Grid.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + 20, GridPanelVertical.Grid.Width + CurrentMenu.WidthOffset - 40, GridPanelVertical.Grid.Height - 40) 26 | 27 | ---@type boolean 28 | local Selected = false 29 | 30 | ---@type number 31 | local CircleX = CurrentMenu.X + GridPanelVertical.Grid.X + (CurrentMenu.WidthOffset / 2) + 20 32 | 33 | ---@type number 34 | local CircleY = CurrentMenu.Y + GridPanelVertical.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + 20 35 | 36 | local X = 0.5 37 | 38 | if Y < 0.0 or Y > 1.0 then 39 | Y = 0.0 40 | end 41 | 42 | CircleX = CircleX + ((GridPanelVertical.Grid.Width - 40) * X) - (GridPanelVertical.Circle.Width / 2) 43 | CircleY = CircleY + ((GridPanelVertical.Grid.Height - 40) * Y) - (GridPanelVertical.Circle.Height / 2) 44 | 45 | RenderSprite(GridPanelVertical.Background.Dictionary, GridPanelVertical.Background.Texture, CurrentMenu.X, CurrentMenu.Y + GridPanelVertical.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, GridPanelVertical.Background.Width + CurrentMenu.WidthOffset, GridPanelVertical.Background.Height) 46 | RenderSprite(GridPanelVertical.Grid.Dictionary, GridPanelVertical.Grid.Texture, CurrentMenu.X + GridPanelVertical.Grid.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + GridPanelVertical.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, GridPanelVertical.Grid.Width, GridPanelVertical.Grid.Height) 47 | RenderSprite(GridPanelVertical.Circle.Dictionary, GridPanelVertical.Circle.Texture, CircleX, CircleY, GridPanelVertical.Circle.Width, GridPanelVertical.Circle.Height) 48 | 49 | RenderText(TopText or "", CurrentMenu.X + GridPanelVertical.Text.Top.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + GridPanelVertical.Text.Top.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, GridPanelVertical.Text.Top.Scale, 245, 245, 245, 255, 1) 50 | RenderText(BottomText or "", CurrentMenu.X + GridPanelVertical.Text.Bottom.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + GridPanelVertical.Text.Bottom.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, GridPanelVertical.Text.Bottom.Scale, 245, 245, 245, 255, 1) 51 | 52 | if Hovered then 53 | if IsDisabledControlPressed(0, 24) then 54 | Selected = true 55 | 56 | CircleY = math.round(GetControlNormal(0, 240) * 1080) - CurrentMenu.SafeZoneSize.Y - (RageUI.Settings.Panels.Grid.Circle.Height / 2) 57 | 58 | if CircleY > (CurrentMenu.Y + RageUI.Settings.Panels.Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + 20 + RageUI.Settings.Panels.Grid.Grid.Height - 40) then 59 | CircleY = CurrentMenu.Y + RageUI.Settings.Panels.Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + 20 + RageUI.Settings.Panels.Grid.Grid.Height - 40 60 | elseif CircleY < (CurrentMenu.Y + RageUI.Settings.Panels.Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + 20 - (RageUI.Settings.Panels.Grid.Circle.Height / 2)) then 61 | CircleY = CurrentMenu.Y + RageUI.Settings.Panels.Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + 20 - (RageUI.Settings.Panels.Grid.Circle.Height / 2) 62 | end 63 | 64 | Y = math.round((CircleY - (CurrentMenu.Y + RageUI.Settings.Panels.Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + 20) + (RageUI.Settings.Panels.Grid.Circle.Height / 2)) / (RageUI.Settings.Panels.Grid.Grid.Height - 40), 2) 65 | 66 | if Y > 1.0 then 67 | Y = 1.0 68 | end 69 | end 70 | end 71 | RageUI.ItemOffset = RageUI.ItemOffset + GridPanelVertical.Background.Height + GridPanelVertical.Background.Y 72 | if Hovered and Selected then 73 | local Audio = RageUI.Settings.Audio 74 | RageUI.PlaySound(Audio[Audio.Use].Slider.audioName, Audio[Audio.Use].Slider.audioRef, true) 75 | end 76 | Callback(Hovered, Selected, Y) 77 | end 78 | end 79 | end 80 | -------------------------------------------------------------------------------- /vendors/RageUI/components/Text.lua: -------------------------------------------------------------------------------- 1 | 2 | ---MeasureStringWidth 3 | --- 4 | --- Reference : Frazzle <3 5 | --- 6 | ---@param str string 7 | ---@param font number 8 | ---@param scale number 9 | ---@return _G 10 | ---@public 11 | function MeasureStringWidth(str, font, scale) 12 | BeginTextCommandWidth("CELL_EMAIL_BCON") 13 | AddTextComponentSubstringPlayerName(str) 14 | SetTextFont(font or 0) 15 | SetTextScale(1.0, scale or 0) 16 | return EndTextCommandGetWidth(true) * 1920 17 | end 18 | 19 | ---GetCharacterCount 20 | --- 21 | --- Reference : Frazzle <3 22 | --- 23 | ---@param Str string 24 | ---@return number 25 | ---@public 26 | function GetCharacterCount(Str) 27 | ---@type number 28 | local Chars = 0 29 | 30 | for Char in Str:gmatch("[%z\1-\127\194-\244][\128-\191]*") do 31 | Chars = Chars + 1 32 | end 33 | 34 | return Chars 35 | end 36 | 37 | ---AddText 38 | --- 39 | --- Reference : Frazzle <3 40 | --- 41 | ---@param Text string 42 | ---@return nil 43 | ---@public 44 | function AddText(Text) 45 | ---@type number 46 | local Characters = GetCharacterCount(Text) 47 | if Characters < 100 then 48 | AddTextComponentSubstringPlayerName(Text) 49 | else 50 | ---@type number 51 | local StringsNeeded = (Characters % 100 == 0) and Characters / 100 or (Characters / 100) + 1 52 | for Index = 0, StringsNeeded do 53 | AddTextComponentSubstringPlayerName(Text:sub(Index * 100, (Index * 100) + 100)) 54 | end 55 | end 56 | end 57 | 58 | ---GetLineCount 59 | --- 60 | --- Reference : Frazzle <3 61 | --- 62 | ---@param Text string 63 | ---@param X number 64 | ---@param Y number 65 | ---@param Font number 66 | ---@param Scale number 67 | ---@param R number 68 | ---@param G number 69 | ---@param B number 70 | ---@param A number 71 | ---@param Alignment string 72 | ---@param DropShadow boolean 73 | ---@param Outline boolean 74 | ---@param WordWrap number 75 | ---@return function 76 | ---@public 77 | function GetLineCount(Text, X, Y, Font, Scale, R, G, B, A, Alignment, DropShadow, Outline, WordWrap) 78 | 79 | ---@type table 80 | local Text, X, Y = tostring(Text), (tonumber(X) or 0) / 1920, (tonumber(Y) or 0) / 1080 81 | 82 | SetTextFont(Font or 0) 83 | SetTextScale(1.0, Scale or 0) 84 | SetTextColour(tonumber(R) or 255, tonumber(G) or 255, tonumber(B) or 255, tonumber(A) or 255) 85 | 86 | if DropShadow then 87 | SetTextDropShadow() 88 | end 89 | 90 | if Outline then 91 | SetTextOutline() 92 | end 93 | 94 | if Alignment ~= nil then 95 | if Alignment == 1 or Alignment == "Center" or Alignment == "Centre" then 96 | SetTextCentre(true) 97 | elseif Alignment == 2 or Alignment == "Right" then 98 | SetTextRightJustify(true) 99 | end 100 | end 101 | 102 | if tonumber(WordWrap) and tonumber(WordWrap) ~= 0 then 103 | if Alignment == 1 or Alignment == "Center" or Alignment == "Centre" then 104 | SetTextWrap(X - ((WordWrap / 1920) / 2), X + ((WordWrap / 1920) / 2)) 105 | elseif Alignment == 2 or Alignment == "Right" then 106 | SetTextWrap(0, X) 107 | else 108 | SetTextWrap(X, X + (WordWrap / 1920)) 109 | end 110 | else 111 | if Alignment == 2 or Alignment == "Right" then 112 | SetTextWrap(0, X) 113 | end 114 | end 115 | 116 | BeginTextCommandLineCount("CELL_EMAIL_BCON") 117 | AddText(Text) 118 | return GetTextScreenLineCount(X, Y) 119 | end 120 | 121 | 122 | ---RenderText 123 | --- 124 | --- Reference : https://github.com/iTexZoz/NativeUILua_Reloaded/blob/master/UIElements/UIResText.lua#L189 125 | --- 126 | ---@param Text string 127 | ---@param X number 128 | ---@param Y number 129 | ---@param Font number 130 | ---@param Scale number 131 | ---@param R number 132 | ---@param G number 133 | ---@param B number 134 | ---@param A number 135 | ---@param Alignment string 136 | ---@param DropShadow boolean 137 | ---@param Outline boolean 138 | ---@param WordWrap number 139 | ---@return nil 140 | ---@public 141 | function RenderText(Text, X, Y, Font, Scale, R, G, B, A, Alignment, DropShadow, Outline, WordWrap) 142 | 143 | ---@type table 144 | local Text, X, Y = tostring(Text), (tonumber(X) or 0) / 1920, (tonumber(Y) or 0) / 1080 145 | 146 | SetTextFont(Font or 0) 147 | SetTextScale(1.0, Scale or 0) 148 | SetTextColour(tonumber(R) or 255, tonumber(G) or 255, tonumber(B) or 255, tonumber(A) or 255) 149 | 150 | if DropShadow then 151 | SetTextDropShadow() 152 | end 153 | 154 | if Outline then 155 | SetTextOutline() 156 | end 157 | 158 | if Alignment ~= nil then 159 | if Alignment == 1 or Alignment == "Center" or Alignment == "Centre" then 160 | SetTextCentre(true) 161 | elseif Alignment == 2 or Alignment == "Right" then 162 | SetTextRightJustify(true) 163 | end 164 | end 165 | 166 | if tonumber(WordWrap) and tonumber(WordWrap) ~= 0 then 167 | if Alignment == 1 or Alignment == "Center" or Alignment == "Centre" then 168 | SetTextWrap(X - ((WordWrap / 1920) / 2), X + ((WordWrap / 1920) / 2)) 169 | elseif Alignment == 2 or Alignment == "Right" then 170 | SetTextWrap(0, X) 171 | else 172 | SetTextWrap(X, X + (WordWrap / 1920)) 173 | end 174 | else 175 | if Alignment == 2 or Alignment == "Right" then 176 | SetTextWrap(0, X) 177 | end 178 | end 179 | 180 | BeginTextCommandDisplayText("CELL_EMAIL_BCON") 181 | AddText(Text) 182 | EndTextCommandDisplayText(X, Y) 183 | end 184 | -------------------------------------------------------------------------------- /vendors/RageUI/menu/panels/UIGridPanel.lua: -------------------------------------------------------------------------------- 1 | local Grid = { 2 | Background = { Dictionary = "commonmenu", Texture = "gradient_bgd", Y = 4, Width = 431, Height = 275 }, 3 | Grid = { Dictionary = "pause_menu_pages_char_mom_dad", Texture = "nose_grid", X = 115.5, Y = 47.5, Width = 200, Height = 200 }, 4 | Circle = { Dictionary = "mpinventory", Texture = "in_world_circle", X = 115.5, Y = 47.5, Width = 20, Height = 20 }, 5 | Text = { 6 | Top = { X = 215.5, Y = 15, Scale = 0.35 }, 7 | Bottom = { X = 215.5, Y = 250, Scale = 0.35 }, 8 | Left = { X = 57.75, Y = 130, Scale = 0.35 }, 9 | Right = { X = 373.25, Y = 130, Scale = 0.35 }, 10 | }, 11 | } 12 | 13 | 14 | ---GridPanel 15 | ---@param X number 16 | ---@param Y number 17 | ---@param TopText string 18 | ---@param BottomText string 19 | ---@param LeftText string 20 | ---@param RightText string 21 | ---@param Callback table 22 | ---@return table 23 | ---@public 24 | function RageUI.GridPanel(X, Y, TopText, BottomText, LeftText, RightText, Callback, Index) 25 | local CurrentMenu = RageUI.CurrentMenu 26 | if CurrentMenu ~= nil then 27 | if CurrentMenu() and (Index == nil or (CurrentMenu.Index == Index)) then 28 | 29 | ---@type boolean 30 | local Hovered = RageUI.IsMouseInBounds(CurrentMenu.X + Grid.Grid.X + CurrentMenu.SafeZoneSize.X + 20, CurrentMenu.Y + Grid.Grid.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + 20, Grid.Grid.Width + CurrentMenu.WidthOffset - 40, Grid.Grid.Height - 40) 31 | 32 | ---@type boolean 33 | local Selected = false 34 | 35 | ---@type number 36 | local CircleX = CurrentMenu.X + Grid.Grid.X + (CurrentMenu.WidthOffset / 2) + 20 37 | 38 | ---@type number 39 | local CircleY = CurrentMenu.Y + Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + 20 40 | 41 | if X < 0.0 or X > 1.0 then 42 | X = 0.0 43 | end 44 | 45 | if Y < 0.0 or Y > 1.0 then 46 | Y = 0.0 47 | end 48 | 49 | CircleX = CircleX + ((Grid.Grid.Width - 40) * X) - (Grid.Circle.Width / 2) 50 | CircleY = CircleY + ((Grid.Grid.Height - 40) * Y) - (Grid.Circle.Height / 2) 51 | 52 | RenderSprite(Grid.Background.Dictionary, Grid.Background.Texture, CurrentMenu.X, CurrentMenu.Y + Grid.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Grid.Background.Width + CurrentMenu.WidthOffset, Grid.Background.Height) 53 | RenderSprite(Grid.Grid.Dictionary, Grid.Grid.Texture, CurrentMenu.X + Grid.Grid.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Grid.Grid.Width, Grid.Grid.Height) 54 | RenderSprite(Grid.Circle.Dictionary, Grid.Circle.Texture, CircleX, CircleY, Grid.Circle.Width, Grid.Circle.Height) 55 | 56 | RenderText(TopText or "", CurrentMenu.X + Grid.Text.Top.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Grid.Text.Top.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Grid.Text.Top.Scale, 245, 245, 245, 255, 1) 57 | RenderText(BottomText or "", CurrentMenu.X + Grid.Text.Bottom.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Grid.Text.Bottom.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Grid.Text.Bottom.Scale, 245, 245, 245, 255, 1) 58 | RenderText(LeftText or "", CurrentMenu.X + Grid.Text.Left.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Grid.Text.Left.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Grid.Text.Left.Scale, 245, 245, 245, 255, 1) 59 | RenderText(RightText or "", CurrentMenu.X + Grid.Text.Right.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Grid.Text.Right.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Grid.Text.Right.Scale, 245, 245, 245, 255, 1) 60 | 61 | if Hovered then 62 | if IsDisabledControlPressed(0, 24) then 63 | Selected = true 64 | 65 | CircleX = math.round(GetControlNormal(0, 239) * 1920) - CurrentMenu.SafeZoneSize.X - (Grid.Circle.Width / 2) 66 | CircleY = math.round(GetControlNormal(0, 240) * 1080) - CurrentMenu.SafeZoneSize.Y - (Grid.Circle.Height / 2) 67 | 68 | if CircleX > (CurrentMenu.X + Grid.Grid.X + (CurrentMenu.WidthOffset / 2) + 20 + Grid.Grid.Width - 40) then 69 | CircleX = CurrentMenu.X + Grid.Grid.X + (CurrentMenu.WidthOffset / 2) + 20 + Grid.Grid.Width - 40 70 | elseif CircleX < (CurrentMenu.X + Grid.Grid.X + 20 - (Grid.Circle.Width / 2)) then 71 | CircleX = CurrentMenu.X + Grid.Grid.X + 20 - (Grid.Circle.Width / 2) 72 | end 73 | 74 | if CircleY > (CurrentMenu.Y + Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + 20 + Grid.Grid.Height - 40) then 75 | CircleY = CurrentMenu.Y + Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + 20 + Grid.Grid.Height - 40 76 | elseif CircleY < (CurrentMenu.Y + Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + 20 - (Grid.Circle.Height / 2)) then 77 | CircleY = CurrentMenu.Y + Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + 20 - (Grid.Circle.Height / 2) 78 | end 79 | 80 | X = math.round((CircleX - (CurrentMenu.X + Grid.Grid.X + (CurrentMenu.WidthOffset / 2) + 20) + (Grid.Circle.Width / 2)) / (Grid.Grid.Width - 40), 2) 81 | Y = math.round((CircleY - (CurrentMenu.Y + Grid.Grid.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + 20) + (Grid.Circle.Height / 2)) / (Grid.Grid.Height - 40), 2) 82 | 83 | if X > 1.0 then 84 | X = 1.0 85 | end 86 | if Y > 1.0 then 87 | Y = 1.0 88 | end 89 | end 90 | end 91 | RageUI.ItemOffset = RageUI.ItemOffset + Grid.Background.Height + Grid.Background.Y 92 | if Hovered and Selected then 93 | local Audio = RageUI.Settings.Audio 94 | RageUI.PlaySound(Audio[Audio.Use].Slider.audioName, Audio[Audio.Use].Slider.audioRef, true) 95 | end 96 | Callback(Hovered, Selected, X, Y) 97 | end 98 | end 99 | end 100 | 101 | -------------------------------------------------------------------------------- /vendors/RageUI/menu/panels/UIColourPanel.lua: -------------------------------------------------------------------------------- 1 | ---@type table 2 | local Colour = { 3 | Background = { Dictionary = "commonmenu", Texture = "gradient_bgd", Y = 4, Width = 431, Height = 112 }, 4 | LeftArrow = { Dictionary = "commonmenu", Texture = "arrowleft", X = 7.5, Y = 15, Width = 30, Height = 30 }, 5 | RightArrow = { Dictionary = "commonmenu", Texture = "arrowright", X = 393.5, Y = 15, Width = 30, Height = 30 }, 6 | Header = { X = 215.5, Y = 15, Scale = 0.35 }, 7 | Box = { X = 15, Y = 55, Width = 44.5, Height = 44.5 }, 8 | SelectedRectangle = { X = 15, Y = 47, Width = 44.5, Height = 8 }, 9 | } 10 | 11 | ---ColourPanel 12 | ---@param Title string 13 | ---@param Colours thread 14 | ---@param MinimumIndex number 15 | ---@param CurrentIndex number 16 | ---@param Callback function 17 | ---@return nil 18 | ---@public 19 | function RageUI.ColourPanel(Title, Colours, MinimumIndex, CurrentIndex, Callback, Index) 20 | 21 | ---@type table 22 | local CurrentMenu = RageUI.CurrentMenu; 23 | 24 | if CurrentMenu ~= nil then 25 | if CurrentMenu() and (Index == nil or (CurrentMenu.Index == Index)) then 26 | 27 | ---@type number 28 | local Maximum = (#Colours > 9) and 9 or #Colours 29 | 30 | ---@type boolean 31 | local Hovered = RageUI.IsMouseInBounds(CurrentMenu.X + Colour.Box.X + CurrentMenu.SafeZoneSize.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Colour.Box.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, (Colour.Box.Width * Maximum), Colour.Box.Height) 32 | 33 | ---@type number 34 | local LeftArrowHovered = RageUI.IsMouseInBounds(CurrentMenu.X + Colour.LeftArrow.X + CurrentMenu.SafeZoneSize.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Colour.LeftArrow.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Colour.LeftArrow.Width, Colour.LeftArrow.Height) 35 | 36 | ---@type number 37 | local RightArrowHovered = RageUI.IsMouseInBounds(CurrentMenu.X + Colour.RightArrow.X + CurrentMenu.SafeZoneSize.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Colour.RightArrow.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Colour.RightArrow.Width, Colour.RightArrow.Height) 38 | 39 | ---@type boolean 40 | local Selected = false 41 | 42 | RenderSprite(Colour.Background.Dictionary, Colour.Background.Texture, CurrentMenu.X, CurrentMenu.Y + Colour.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Colour.Background.Width + CurrentMenu.WidthOffset, Colour.Background.Height) 43 | RenderSprite(Colour.LeftArrow.Dictionary, Colour.LeftArrow.Texture, CurrentMenu.X + Colour.LeftArrow.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Colour.LeftArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Colour.LeftArrow.Width, Colour.LeftArrow.Height) 44 | RenderSprite(Colour.RightArrow.Dictionary, Colour.RightArrow.Texture, CurrentMenu.X + Colour.RightArrow.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Colour.RightArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Colour.RightArrow.Width, Colour.RightArrow.Height) 45 | 46 | RenderRectangle(CurrentMenu.X + Colour.SelectedRectangle.X + (Colour.Box.Width * (CurrentIndex - MinimumIndex)) + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Colour.SelectedRectangle.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Colour.SelectedRectangle.Width, Colour.SelectedRectangle.Height, 245, 245, 245, 255) 47 | 48 | for Index = 1, Maximum do 49 | RenderRectangle(CurrentMenu.X + Colour.Box.X + (Colour.Box.Width * (Index - 1)) + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Colour.Box.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Colour.Box.Width, Colour.Box.Height, table.unpack(Colours[MinimumIndex + Index - 1])) 50 | end 51 | 52 | RenderText((Title and Title or "") .. " (" .. CurrentIndex .. " of " .. #Colours .. ")", CurrentMenu.X + RageUI.Settings.Panels.Grid.Text.Top.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + RageUI.Settings.Panels.Grid.Text.Top.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, RageUI.Settings.Panels.Grid.Text.Top.Scale, 245, 245, 245, 255, 1) 53 | 54 | if Hovered or LeftArrowHovered or RightArrowHovered then 55 | if RageUI.Settings.Controls.Click.Active then 56 | Selected = true 57 | if LeftArrowHovered then 58 | CurrentIndex = CurrentIndex - 1 59 | if CurrentIndex < 1 then 60 | CurrentIndex = #Colours 61 | MinimumIndex = #Colours - Maximum + 1 62 | elseif CurrentIndex < MinimumIndex then 63 | MinimumIndex = MinimumIndex - 1 64 | end 65 | elseif RightArrowHovered then 66 | CurrentIndex = CurrentIndex + 1 67 | if CurrentIndex > #Colours then 68 | CurrentIndex = 1 69 | MinimumIndex = 1 70 | elseif CurrentIndex > MinimumIndex + Maximum - 1 then 71 | MinimumIndex = MinimumIndex + 1 72 | end 73 | elseif Hovered then 74 | for Index = 1, Maximum do 75 | if RageUI.IsMouseInBounds(CurrentMenu.X + Colour.Box.X + (Colour.Box.Width * (Index - 1)) + CurrentMenu.SafeZoneSize.X + (CurrentMenu.WidthOffset / 2), CurrentMenu.Y + Colour.Box.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Colour.Box.Width, Colour.Box.Height) then 76 | CurrentIndex = MinimumIndex + Index - 1 77 | end 78 | end 79 | end 80 | end 81 | end 82 | 83 | 84 | RageUI.ItemOffset = RageUI.ItemOffset + Colour.Background.Height + Colour.Background.Y 85 | 86 | if (Hovered or LeftArrowHovered or RightArrowHovered) and RageUI.Settings.Controls.Click.Active then 87 | local Audio = RageUI.Settings.Audio 88 | RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef) 89 | end 90 | 91 | Callback((Hovered or LeftArrowHovered or RightArrowHovered), Selected, MinimumIndex, CurrentIndex) 92 | end 93 | end 94 | end 95 | 96 | 97 | -------------------------------------------------------------------------------- /server/main.lua: -------------------------------------------------------------------------------- 1 | ESX, cryptos, watchers = nil, {}, {} 2 | 3 | wallet = {} 4 | 5 | -- DO NOT ACTIVATE (Debug command only) 6 | --[[ 7 | RegisterCommand("debugCmd", function(source) 8 | local _src = source 9 | local identifier = ESX.GetPlayerFromId(_src).identifier 10 | MySQL.Async.execute("INSERT INTO cryptos_wallet (identifier,wallet) VALUES(@a,@b)", { 11 | ['a'] = identifier, 12 | ['b'] = json.encode({["bitcoin"] = 170}) 13 | }) 14 | end, false) 15 | --]] 16 | 17 | local function sendToDiscord(name,message,color) 18 | local DiscordWebHook = Config.webhook 19 | local embeds = { 20 | { 21 | ["title"]=message, 22 | ["type"]="rich", 23 | ["color"] =Config.webhook_mess_color, 24 | ["footer"]= { 25 | ["text"]= "zCrypto", 26 | }, 27 | } 28 | } 29 | PerformHttpRequest(DiscordWebHook, function(err, text, headers) end, 'POST', json.encode({ username = name,embeds = embeds}), { ['Content-Type'] = 'application/json' }) 30 | end 31 | 32 | local function initCryptoVariator() 33 | debug("Initialisation de la boucle de crypto") 34 | Citizen.CreateThread(function() 35 | while true do 36 | for crypto, cryptoData in pairs(cryptos) do 37 | if Config.crypto.noChangeChance() then 38 | cryptos[crypto].positive = nil 39 | debug("La valeur de "..crypto.." ne change pas !") 40 | else 41 | local newCryptoValue, isPositive = alterCryptoValue(cryptoData.value) 42 | cryptos[crypto].positive = isPositive 43 | cryptos[crypto].value = newCryptoValue 44 | debug("La valeur de "..crypto.." s'élève désormais à "..newCryptoValue.."$") 45 | end 46 | end 47 | debug("--------------------------------------") 48 | for source, _ in pairs(watchers) do 49 | TriggerClientEvent("crypto:updateCryptoValue", source, cryptos) 50 | end 51 | Wait(Config.crypto.cryptoVariationCycle*1000) 52 | end 53 | end) 54 | end 55 | 56 | local function getCryptoValueFromDb() 57 | local wait = true 58 | MySQL.Async.fetchAll("SELECT * FROM cryptos", {}, function(result) 59 | for _, data in pairs(result) do 60 | cryptos[data.name] = {value = data.value, label = data.label, positive = true} 61 | end 62 | wait = false 63 | end) 64 | repeat Wait(0) until not wait 65 | 66 | wait = true 67 | MySQL.Async.fetchAll("SELECT * FROM cryptos_wallet", {}, function(result) 68 | for k,v in pairs(result) do 69 | wallet[v.identifier] = json.decode(v.wallet) 70 | end 71 | wait = false 72 | end) 73 | end 74 | 75 | TriggerEvent(Config.esxGetter, function(obj) 76 | ESX = obj 77 | getCryptoValueFromDb() 78 | initCryptoVariator() 79 | end) 80 | 81 | AddEventHandler('onResourceStop', function(resourceName) 82 | if (GetCurrentResourceName() ~= resourceName) then 83 | return 84 | end 85 | debug("Test") 86 | for k,v in pairs(cryptos) do 87 | debug("Loop "..k) 88 | MySQL.Async.execute("UPDATE cryptos SET value = @a WHERE name = @b", { 89 | ['a'] = v.value, 90 | ['b'] = k 91 | }) 92 | end 93 | end) 94 | 95 | RegisterNetEvent("crypto:openCryptoMenu") 96 | AddEventHandler("crypto:openCryptoMenu", function() 97 | local _src = source 98 | local xPlayer = ESX.GetPlayerFromId(_src) 99 | watchers[_src] = GetPlayerName(_src) 100 | TriggerClientEvent("crypto:cbOpenMenu", _src, cryptos, {xPlayer.getMoney(), xPlayer.getAccount("bank").money}, wallet[xPlayer.identifier] or {}) 101 | end) 102 | 103 | RegisterNetEvent("crypto:closeCryptoMenu") 104 | AddEventHandler("crypto:closeCryptoMenu", function() 105 | local _src = source 106 | watchers[_src] = nil 107 | end) 108 | 109 | RegisterNetEvent("crypto:buyCryptos") 110 | AddEventHandler("crypto:buyCryptos", function(type, qty) 111 | qty = tonumber(qty) 112 | local _src = source 113 | local xPlayer = ESX.GetPlayerFromId(_src) 114 | local identifier = xPlayer.identifier 115 | local requiered = cryptos[type].value * qty 116 | if xPlayer.getMoney() >= requiered then 117 | xPlayer.removeMoney(requiered) 118 | elseif xPlayer.getAccount("bank").money >= requiered then 119 | xPlayer.removeAccountMoney("bank", requiered) 120 | else 121 | TriggerClientEvent("crypto:cbServer", _src, "~r~Vous n'avez pas assez d'argent pour acheter ~b~"..qty.." "..cryptos[type].label) 122 | return 123 | end 124 | local sync = false 125 | if not wallet[identifier] then 126 | sync = true 127 | wallet[identifier] = {} 128 | MySQL.Async.insert("INSERT INTO cryptos_wallet (identifier, wallet) VALUES(@a,@b)", { 129 | ["a"] = identifier, 130 | ["b"] = json.encode({}) 131 | }, function(insertId) 132 | sync = false 133 | end) 134 | end 135 | while sync do Wait(1) end 136 | if not wallet[identifier][type] then 137 | wallet[identifier][type] = 0 138 | end 139 | wallet[identifier][type] = wallet[identifier][type] + qty 140 | MySQL.Async.execute("UPDATE cryptos_wallet SET wallet = @a WHERE identifier = @b", { 141 | ["a"] = json.encode(wallet[identifier]), 142 | ["b"] = identifier 143 | }) 144 | TriggerClientEvent("cryptos:cbWallet", _src, wallet[identifier]) 145 | TriggerClientEvent("cryptos:cbMoney", _src, {xPlayer.getMoney(), xPlayer.getAccount("bank").money}) 146 | TriggerClientEvent("crypto:cbServer", _src, "~g~Achat effectué") 147 | sendToDiscord("Crypto", "Le joueur **"..GetPlayerName(_src).." ["..identifier.."] a acheté "..qty.." "..type) 148 | end) 149 | 150 | RegisterNetEvent("crypto:sellCryptos") 151 | AddEventHandler("crypto:sellCryptos", function(type, qty) 152 | qty = tonumber(qty) 153 | local _src = source 154 | local xPlayer = ESX.GetPlayerFromId(_src) 155 | local identifier = xPlayer.identifier 156 | if not wallet[identifier] then 157 | TriggerClientEvent("crypto:cbServer", _src, "~r~Vous n'avez pas de cryptos") 158 | return 159 | end 160 | local cryptoAmmount = (wallet[identifier][type] or 0) 161 | if cryptoAmmount < qty then 162 | TriggerClientEvent("crypto:cbServer", _src, "~r~Vous n'avez pas assez de ~b~"..cryptos[type].label) 163 | return 164 | end 165 | local fakeRemainCryptos = (wallet[identifier][type] - qty) 166 | if (fakeRemainCryptos <= 0) then 167 | wallet[identifier][type] = nil 168 | else 169 | wallet[identifier][type] = fakeRemainCryptos 170 | end 171 | MySQL.Async.execute("UPDATE cryptos_wallet SET wallet = @a WHERE identifier = @b", { 172 | ["a"] = json.encode(wallet[identifier]), 173 | ["b"] = identifier 174 | }) 175 | local reward = (cryptos[type].value * qty) 176 | xPlayer.addMoney(reward) 177 | TriggerClientEvent("cryptos:cbWallet", _src, wallet[identifier]) 178 | TriggerClientEvent("cryptos:cbMoney", _src, {xPlayer.getMoney(), xPlayer.getAccount("bank").money}) 179 | TriggerClientEvent("crypto:cbServer", _src, "~g~Vente effectuée") 180 | sendToDiscord("Crypto", "Le joueur **"..GetPlayerName(_src).." ["..identifier.."] a vendu "..qty.." "..type) 181 | end) 182 | 183 | -------------------------------------------------------------------------------- /vendors/RageUI/menu/items/UISliderHeritage.lua: -------------------------------------------------------------------------------- 1 | ---@type table 2 | local SettingsButton = { 3 | Rectangle = { Y = 0, Width = 431, Height = 38 }, 4 | Text = { X = 8, Y = 3, Scale = 0.33 }, 5 | SelectedSprite = { Dictionary = "commonmenu", Texture = "gradient_nav", Y = 0, Width = 431, Height = 38 }, 6 | } 7 | 8 | ---@type table 9 | local SettingsSlider = { 10 | Background = { X = 250, Y = 14.5, Width = 150, Height = 9 }, 11 | Slider = { X = 250, Y = 14.5, Width = 75, Height = 9 }, 12 | Divider = { X = 323.5, Y = 9, Width = 2.5, Height = 20 }, 13 | LeftArrow = { Dictionary = "mpleaderboard", Texture = "leaderboard_female_icon", X = 215, Y = 0, Width = 40, Height = 40 }, 14 | RightArrow = { Dictionary = "mpleaderboard", Texture = "leaderboard_male_icon", X = 395, Y = 0, Width = 40, Height = 40 }, 15 | } 16 | 17 | local Items = {} 18 | for i = 1, 10 do 19 | table.insert(Items, i) 20 | end 21 | 22 | ---UISliderHeritage 23 | --- 24 | --- 25 | --- 26 | ---@param Label string 27 | ---@param ItemIndex number 28 | ---@param Description string 29 | ---@param Callback function 30 | function RageUI.UISliderHeritage(Label, ItemIndex, Description, Callback, Value) 31 | 32 | ---@type table 33 | local CurrentMenu = RageUI.CurrentMenu; 34 | local Audio = RageUI.Settings.Audio 35 | 36 | if CurrentMenu ~= nil then 37 | if CurrentMenu() then 38 | 39 | ---@type number 40 | local Option = RageUI.Options + 1 41 | 42 | if CurrentMenu.Pagination.Minimum <= Option and CurrentMenu.Pagination.Maximum >= Option then 43 | 44 | ---@type number 45 | local value = Value or 0.1 46 | local Selected = CurrentMenu.Index == Option 47 | 48 | ---@type boolean 49 | local LeftArrowHovered, RightArrowHovered = false, false 50 | 51 | RageUI.ItemsSafeZone(CurrentMenu) 52 | 53 | local Hovered = false; 54 | local RightOffset = 0 55 | 56 | ---@type boolean 57 | if CurrentMenu.EnableMouse == true and (CurrentMenu.CursorStyle == 0) or (CurrentMenu.CursorStyle == 1) then 58 | Hovered = RageUI.ItemsMouseBounds(CurrentMenu, Selected, Option, SettingsButton); 59 | end 60 | 61 | if Selected then 62 | RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height) 63 | LeftArrowHovered = RageUI.IsMouseInBounds(CurrentMenu.X + SettingsSlider.LeftArrow.X + CurrentMenu.SafeZoneSize.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsSlider.LeftArrow.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.LeftArrow.Width, SettingsSlider.LeftArrow.Height) 64 | RightArrowHovered = RageUI.IsMouseInBounds(CurrentMenu.X + SettingsSlider.RightArrow.X + CurrentMenu.SafeZoneSize.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsSlider.RightArrow.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.RightArrow.Width, SettingsSlider.RightArrow.Height) 65 | end 66 | 67 | RightOffset = RightOffset 68 | 69 | if Selected then 70 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 0, 0, 0, 255) 71 | 72 | RenderSprite(SettingsSlider.LeftArrow.Dictionary, SettingsSlider.LeftArrow.Texture, CurrentMenu.X + SettingsSlider.LeftArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.LeftArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.LeftArrow.Width, SettingsSlider.LeftArrow.Height, 0, 0, 0, 0, 255) 73 | RenderSprite(SettingsSlider.RightArrow.Dictionary, SettingsSlider.RightArrow.Texture, CurrentMenu.X + SettingsSlider.RightArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.RightArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.RightArrow.Width, SettingsSlider.RightArrow.Height, 0, 0, 0, 0, 255) 74 | else 75 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 245, 245, 245, 255) 76 | 77 | RenderSprite(SettingsSlider.LeftArrow.Dictionary, SettingsSlider.LeftArrow.Texture, CurrentMenu.X + SettingsSlider.LeftArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.LeftArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.LeftArrow.Width, SettingsSlider.LeftArrow.Height, 0, 255, 255, 255, 255) 78 | RenderSprite(SettingsSlider.RightArrow.Dictionary, SettingsSlider.RightArrow.Texture, CurrentMenu.X + SettingsSlider.RightArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.RightArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.RightArrow.Width, SettingsSlider.RightArrow.Height, 0, 255, 255, 255, 255) 79 | end 80 | 81 | RenderRectangle(CurrentMenu.X + SettingsSlider.Background.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.Background.Width, SettingsSlider.Background.Height, 4, 32, 57, 255) 82 | RenderRectangle(CurrentMenu.X + SettingsSlider.Slider.X + (((SettingsSlider.Background.Width - SettingsSlider.Slider.Width) / (#Items)) * (ItemIndex)) + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.Slider.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.Slider.Width, SettingsSlider.Slider.Height, 57, 116, 200, 255) 83 | 84 | RenderRectangle(CurrentMenu.X + SettingsSlider.Divider.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsSlider.Divider.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.Divider.Width, SettingsSlider.Divider.Height, 245, 245, 245, 255) 85 | 86 | RageUI.ItemOffset = RageUI.ItemOffset + SettingsButton.Rectangle.Height 87 | 88 | RageUI.ItemsDescription(CurrentMenu, Description, Selected); 89 | 90 | if Selected and (CurrentMenu.Controls.SliderLeft.Active or (CurrentMenu.Controls.Click.Active and LeftArrowHovered)) and not (CurrentMenu.Controls.SliderRight.Active or (CurrentMenu.Controls.Click.Active and RightArrowHovered)) then 91 | ItemIndex = ItemIndex - value 92 | if ItemIndex < 0.1 then 93 | ItemIndex = 0.0 94 | else 95 | RageUI.PlaySound(Audio[Audio.Use].Slider.audioName, Audio[Audio.Use].Slider.audioRef, true) 96 | end 97 | elseif Selected and (CurrentMenu.Controls.SliderRight.Active or (CurrentMenu.Controls.Click.Active and RightArrowHovered)) and not (CurrentMenu.Controls.SliderLeft.Active or (CurrentMenu.Controls.Click.Active and LeftArrowHovered)) then 98 | ItemIndex = ItemIndex + value 99 | if ItemIndex > #Items then 100 | ItemIndex = 10 101 | else 102 | RageUI.PlaySound(Audio[Audio.Use].Slider.audioName, Audio[Audio.Use].Slider.audioRef, true) 103 | end 104 | end 105 | 106 | if Selected and (CurrentMenu.Controls.Select.Active or ((Hovered and CurrentMenu.Controls.Click.Active) and (not LeftArrowHovered and not RightArrowHovered))) then 107 | RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef, false) 108 | end 109 | 110 | Callback(Hovered, Selected, ((CurrentMenu.Controls.Select.Active or ((Hovered and CurrentMenu.Controls.Click.Active) and (not LeftArrowHovered and not RightArrowHovered))) and Selected), ItemIndex / 10, ItemIndex) 111 | end 112 | 113 | RageUI.Options = RageUI.Options + 1 114 | end 115 | end 116 | end 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /vendors/RageUI/menu/panels/UIStatisticsPanel.lua: -------------------------------------------------------------------------------- 1 | local Statistics = { 2 | Background = { Dictionary = "commonmenu", Texture = "gradient_bgd", Y = 4, Width = 431, Height = 42 }, 3 | Text = { 4 | Left = { X = -40, Y = 15, Scale = 0.35 }, 5 | }, 6 | Bar = { Right = 8, Y = 27, Width = 200, Height = 10 , OffsetRatio = 0.5 }, 7 | Divider = { 8 | [1] = { X = 200, Y = 27, Width = 2, Height = 10 }, 9 | [2] = { X = 200, Y = 27, Width = 2, Height = 10 }, 10 | [3] = { X = 200, Y = 27, Width = 2, Height = 10 }, 11 | [4] = { X = 200, Y = 27, Width = 2, Height = 10 }, 12 | [5] = { X = 200, Y = 27, Width = 2, Height = 10 }, 13 | } 14 | } 15 | 16 | ---StatisticPanel 17 | ---@param Percent number 18 | ---@param Text string 19 | ---@param Index number 20 | ---@return void 21 | ---@public 22 | function RageUI.StatisticPanel(Percent, Text, Index) 23 | local CurrentMenu = RageUI.CurrentMenu 24 | if CurrentMenu ~= nil then 25 | if CurrentMenu() and (Index == nil or (CurrentMenu.Index == Index)) then 26 | 27 | ---@type number 28 | local BarWidth = Statistics.Bar.Width + CurrentMenu.WidthOffset * Statistics.Bar.OffsetRatio 29 | 30 | --[[ METHOD FOR CHECK IF THE STRING IS NOT TO LONG (and correct if it is) BUT USE WAY TOO MUCH CPU 31 | local textSize, textChar = MeasureStringWidth(Text, 0, Statistics.Text.Left.Scale), GetCharacterCount(Text) 32 | local maxTextSize = RageUI.Settings.Items.Title.Background.Width + CurrentMenu.WidthOffset - (CurrentMenu.X + 8.0 + BarWidth + Statistics.Bar.Right) 33 | if textSize > maxTextSize then 34 | for i = textChar, 1, -1 do 35 | local tempText = string.sub(Text, 0, i) .. "..." 36 | local tempTextSize = string.len(tempText) 37 | if MeasureStringWidth(tempText, 0, Statistics.Text.Left.Scale) < maxTextSize then 38 | Text = tempText 39 | break 40 | end 41 | end 42 | end 43 | ]] 44 | 45 | RenderRectangle(CurrentMenu.X, CurrentMenu.Y + Statistics.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + (RageUI.StatisticPanelCount * 42), Statistics.Background.Width + CurrentMenu.WidthOffset, Statistics.Background.Height, 0, 0, 0, 170) 46 | RenderText(Text or "", CurrentMenu.X + 8.0, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Text.Left.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Statistics.Text.Left.Scale, 245, 245, 245, 255, 0) 47 | RenderRectangle(CurrentMenu.X + RageUI.Settings.Items.Title.Background.Width - BarWidth - Statistics.Bar.Right + CurrentMenu.WidthOffset, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, BarWidth, Statistics.Bar.Height, 87, 87, 87, 255) 48 | RenderRectangle(CurrentMenu.X + RageUI.Settings.Items.Title.Background.Width - BarWidth - Statistics.Bar.Right + CurrentMenu.WidthOffset, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Percent * BarWidth, Statistics.Bar.Height, 255, 255, 255, 255) 49 | for i = 1, #Statistics.Divider, 1 do 50 | RenderRectangle((CurrentMenu.X + RageUI.Settings.Items.Title.Background.Width - BarWidth - Statistics.Bar.Right) + i * ((BarWidth-(#Statistics.Divider/Statistics.Divider[i].Width))/(#Statistics.Divider+1)) + CurrentMenu.WidthOffset, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Divider[i].Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Statistics.Divider[i].Width, Statistics.Divider[i].Height, 0, 0, 0, 255) 51 | end 52 | RageUI.StatisticPanelCount = RageUI.StatisticPanelCount + 1 53 | end 54 | end 55 | end 56 | 57 | 58 | 59 | ---StatisticPanelAdvanced 60 | ---@param Percent number 61 | ---@param RGBA1 Table {R,G,B,A} 62 | ---@param Percent2 number 63 | ---@param RGBA2 Table {R,G,B,A} 64 | ---@param RGBA3 Table {R,G,B,A} 65 | ---@param Text string 66 | ---@param Index number 67 | ---@return void 68 | ---@public 69 | function RageUI.StatisticPanelAdvanced(Text, Percent, RGBA1, Percent2, RGBA2, RGBA3, Index) 70 | local CurrentMenu = RageUI.CurrentMenu 71 | if CurrentMenu ~= nil then 72 | if CurrentMenu() and (Index == nil or (CurrentMenu.Index == Index)) then 73 | 74 | 75 | RGBA1 = RGBA1 or {255,255,255,255} 76 | local BarWidth = Statistics.Bar.Width + CurrentMenu.WidthOffset * Statistics.Bar.OffsetRatio 77 | 78 | --[[ METHOD FOR CHECK IF THE STRING IS NOT TO LONG (and correct if it is) BUT USE WAY TOO MUCH CPU 79 | local textSize, textChar = MeasureStringWidth(Text, 0, Statistics.Text.Left.Scale), GetCharacterCount(Text) 80 | local maxTextSize = RageUI.Settings.Items.Title.Background.Width + CurrentMenu.WidthOffset - (CurrentMenu.X + 8.0 + BarWidth + Statistics.Bar.Right) 81 | if textSize > maxTextSize then 82 | for i = textChar, 1, -1 do 83 | local tempText = string.sub(Text, 0, i) .. "..." 84 | local tempTextSize = string.len(tempText) 85 | if MeasureStringWidth(tempText, 0, Statistics.Text.Left.Scale) < maxTextSize then 86 | Text = tempText 87 | break 88 | end 89 | end 90 | end 91 | ]] 92 | 93 | ---@type number 94 | RenderRectangle(CurrentMenu.X, CurrentMenu.Y + Statistics.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset + (RageUI.StatisticPanelCount * 42), Statistics.Background.Width + CurrentMenu.WidthOffset, Statistics.Background.Height, 0, 0, 0, 170) 95 | RenderText(Text or "", CurrentMenu.X + 8.0, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Text.Left.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, Statistics.Text.Left.Scale, 245, 245, 245, 255, 0) 96 | RenderRectangle(CurrentMenu.X + RageUI.Settings.Items.Title.Background.Width - BarWidth - Statistics.Bar.Right + CurrentMenu.WidthOffset, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, BarWidth, Statistics.Bar.Height, 87, 87, 87, 255) 97 | RenderRectangle(CurrentMenu.X + RageUI.Settings.Items.Title.Background.Width - BarWidth - Statistics.Bar.Right + CurrentMenu.WidthOffset, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Percent * BarWidth, Statistics.Bar.Height, RGBA1[1], RGBA1[2], RGBA1[3], RGBA1[4]) 98 | RGBA2 = RGBA2 or {0, 153, 204,255} 99 | RGBA3 = RGBA3 or {185, 0, 0,255} 100 | 101 | if Percent2 and Percent2 > 0 then 102 | local X = CurrentMenu.X + RageUI.Settings.Items.Title.Background.Width - BarWidth - Statistics.Bar.Right + CurrentMenu.WidthOffset+ Percent * BarWidth 103 | RenderRectangle(X, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Percent2 * BarWidth, Statistics.Bar.Height, RGBA2[1], RGBA2[2], RGBA2[3], RGBA2[4]) 104 | elseif Percent2 and Percent2 < 0 then 105 | local X = CurrentMenu.X + RageUI.Settings.Items.Title.Background.Width - BarWidth - Statistics.Bar.Right + CurrentMenu.WidthOffset+ Percent * BarWidth 106 | RenderRectangle(X, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Percent2 * BarWidth, Statistics.Bar.Height, RGBA3[1], RGBA3[2], RGBA3[3], RGBA3[4]) 107 | end 108 | 109 | for i = 1, #Statistics.Divider, 1 do 110 | RenderRectangle((CurrentMenu.X + RageUI.Settings.Items.Title.Background.Width - BarWidth - Statistics.Bar.Right) + i * ((BarWidth-(#Statistics.Divider/Statistics.Divider[i].Width))/(#Statistics.Divider+1)) + CurrentMenu.WidthOffset, (RageUI.StatisticPanelCount * 40) + CurrentMenu.Y + Statistics.Divider[i].Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, Statistics.Divider[i].Width, Statistics.Divider[i].Height, 0, 0, 0, 255) 111 | end 112 | 113 | RageUI.StatisticPanelCount = RageUI.StatisticPanelCount + 1 114 | end 115 | end 116 | end 117 | 118 | -------------------------------------------------------------------------------- /vendors/RageUI/menu/items/UIProgress.lua: -------------------------------------------------------------------------------- 1 | ---@type table 2 | local SettingsButton = { 3 | Rectangle = { Y = 0, Width = 431, Height = 38 }, 4 | Text = { X = 8, Y = 3, Scale = 0.33 }, 5 | LeftBadge = { Y = -2, Width = 40, Height = 40 }, 6 | RightBadge = { X = 385, Y = -2, Width = 40, Height = 40 }, 7 | RightText = { X = 420, Y = 4, Scale = 0.35 }, 8 | SelectedSprite = { Dictionary = "commonmenu", Texture = "gradient_nav", Y = 0, Width = 431, Height = 38 }, 9 | } 10 | 11 | local SettingsProgress = { 12 | Background = { X = 8, Y = 33, Width = 415, Height = 20 }, 13 | Bar = { X = 11.75, Y = 36.75, Width = 407.5, Height = 12.5 }, 14 | Height = 60 15 | } 16 | 17 | ---Progress 18 | ---@param Label string 19 | ---@param ProgressStart number 20 | ---@param ProgressMax number 21 | ---@param Description string 22 | ---@param Counter number 23 | ---@param Enabled boolean 24 | ---@param Callback function 25 | ---@return nil 26 | ---@public 27 | function RageUI.Progress(Label, ProgressStart, ProgressMax, Description, Counter, Enabled, Callback) 28 | 29 | ---@type table 30 | local CurrentMenu = RageUI.CurrentMenu; 31 | 32 | if CurrentMenu ~= nil then 33 | if CurrentMenu() then 34 | 35 | local Items = {} 36 | for i = 1, ProgressMax do 37 | table.insert(Items, i) 38 | end 39 | 40 | ---@type number 41 | local Option = RageUI.Options + 1 42 | 43 | if CurrentMenu.Pagination.Minimum <= Option and CurrentMenu.Pagination.Maximum >= Option then 44 | 45 | ---@type number 46 | local Selected = CurrentMenu.Index == Option 47 | 48 | ---@type boolean 49 | local ProgressHovered = false 50 | 51 | RageUI.ItemsSafeZone(CurrentMenu) 52 | 53 | local Hovered = false; 54 | 55 | ---@type boolean 56 | if CurrentMenu.EnableMouse == true and (CurrentMenu.CursorStyle == 0) or (CurrentMenu.CursorStyle == 1) then 57 | Hovered = RageUI.ItemsMouseBounds(CurrentMenu, Selected, Option, SettingsButton); 58 | end 59 | 60 | local ProgressText = (Counter and ProgressStart .. "/" .. #Items or (type(Items[ProgressStart]) == "table") and tostring(Items[ProgressStart].Name) or tostring(Items[ProgressStart])) 61 | 62 | if Selected then 63 | RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsProgress.Height) 64 | ProgressHovered = RageUI.IsMouseInBounds(CurrentMenu.X + SettingsProgress.Bar.X + CurrentMenu.SafeZoneSize.X, CurrentMenu.Y + SettingsProgress.Bar.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset - 12, SettingsProgress.Bar.Width + CurrentMenu.WidthOffset, SettingsProgress.Bar.Height + 24) 65 | end 66 | 67 | if Enabled == true or Enabled == nil then 68 | if Selected then 69 | RenderText(ProgressText, CurrentMenu.X + SettingsButton.RightText.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 0, 0, 0, 255, 2) 70 | 71 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 0, 0, 0, 255) 72 | 73 | RenderRectangle(CurrentMenu.X + SettingsProgress.Background.X, CurrentMenu.Y + SettingsProgress.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsProgress.Background.Width + CurrentMenu.WidthOffset, SettingsProgress.Background.Height, 0, 0, 0, 255) 74 | RenderRectangle(CurrentMenu.X + SettingsProgress.Bar.X, CurrentMenu.Y + SettingsProgress.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, ((ProgressStart / #Items) * (SettingsProgress.Bar.Width + CurrentMenu.WidthOffset)), SettingsProgress.Bar.Height, 240, 240, 240, 255) 75 | else 76 | RenderText(ProgressText, CurrentMenu.X + SettingsButton.RightText.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 245, 245, 245, 255, 2) 77 | 78 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 245, 245, 245, 255) 79 | 80 | RenderRectangle(CurrentMenu.X + SettingsProgress.Background.X, CurrentMenu.Y + SettingsProgress.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsProgress.Background.Width + CurrentMenu.WidthOffset, SettingsProgress.Background.Height, 240, 240, 240, 255) 81 | RenderRectangle(CurrentMenu.X + SettingsProgress.Bar.X, CurrentMenu.Y + SettingsProgress.Bar.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, ((ProgressStart / #Items) * (SettingsProgress.Bar.Width + CurrentMenu.WidthOffset)), SettingsProgress.Bar.Height, 0, 0, 0, 255) 82 | end 83 | else 84 | RenderText(ProgressText, CurrentMenu.X + SettingsButton.RightText.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 163, 159, 148, 255, 2) 85 | 86 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 163, 159, 148, 255) 87 | if Selected then 88 | RenderRectangle(CurrentMenu.X + SettingsProgress.Background.X, CurrentMenu.Y + SettingsProgress.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsProgress.Background.Width + CurrentMenu.WidthOffset, SettingsProgress.Background.Height, 0, 0, 0, 255) 89 | else 90 | RenderRectangle(CurrentMenu.X + SettingsProgress.Background.X, CurrentMenu.Y + SettingsProgress.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsProgress.Background.Width + CurrentMenu.WidthOffset, SettingsProgress.Background.Height, 240, 240, 240, 255) 91 | end 92 | end 93 | 94 | RageUI.ItemOffset = RageUI.ItemOffset + SettingsProgress.Height 95 | 96 | RageUI.ItemsDescription(CurrentMenu, Description, Selected); 97 | 98 | if Selected and CurrentMenu.Controls.Left.Active and not CurrentMenu.Controls.Right.Active then 99 | ProgressStart = ProgressStart - 1 100 | 101 | if ProgressStart < 0 then 102 | ProgressStart = #Items 103 | end 104 | 105 | local Audio = RageUI.Settings.Audio 106 | RageUI.PlaySound(Audio[Audio.Use].LeftRight.audioName, Audio[Audio.Use].LeftRight.audioRef) 107 | elseif Selected and CurrentMenu.Controls.Right.Active and not CurrentMenu.Controls.Left.Active then 108 | ProgressStart = ProgressStart + 1 109 | 110 | if ProgressStart > #Items then 111 | ProgressStart = 0 112 | end 113 | local Audio = RageUI.Settings.Audio 114 | RageUI.PlaySound(Audio[Audio.Use].LeftRight.audioName, Audio[Audio.Use].LeftRight.audioRef) 115 | end 116 | 117 | if Selected and (CurrentMenu.Controls.Select.Active or ((Hovered and CurrentMenu.Controls.Click.Active) and not ProgressHovered)) then 118 | local Audio = RageUI.Settings.Audio 119 | RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef) 120 | elseif Selected and (Hovered and CurrentMenu.Controls.Click.Active and ProgressHovered) then 121 | 122 | ---@type number 123 | local Progress = (math.round(GetControlNormal(0, 239) * 1920) - CurrentMenu.SafeZoneSize.X) - SettingsProgress.Bar.X 124 | 125 | ---@type number 126 | local Barsize = SettingsProgress.Bar.Width + CurrentMenu.WidthOffset 127 | 128 | if Progress > Barsize then 129 | Progress = Barsize 130 | elseif Progress < 0 then 131 | Progress = 0 132 | end 133 | 134 | ProgressStart = math.round(#Items * (Progress / Barsize)) 135 | 136 | if ProgressStart > #Items or ProgressStart < 0 then 137 | ProgressStart = 0 138 | end 139 | 140 | end 141 | 142 | if (Enabled) then 143 | Callback(Hovered, Selected, ((CurrentMenu.Controls.Select.Active or ((Hovered and CurrentMenu.Controls.Click.Active) and not ProgressHovered)) and Selected), ProgressStart) 144 | end 145 | end 146 | RageUI.Options = RageUI.Options + 1 147 | 148 | Items = nil 149 | end 150 | end 151 | end 152 | 153 | 154 | -------------------------------------------------------------------------------- /vendors/RageUI/menu/elements/ItemsBadge.lua: -------------------------------------------------------------------------------- 1 | RageUI.BadgeStyle = { 2 | -- DEFAULT BADGE 3 | None = function() 4 | return { 5 | BadgeTexture = "", 6 | BadgeDictionary = "commonmenu" 7 | } 8 | end, 9 | BronzeMedal = function() 10 | return { 11 | BadgeTexture = "mp_medal_bronze", 12 | } 13 | end, 14 | GoldMedal = function() 15 | return { 16 | BadgeTexture = "mp_medal_gold", 17 | } 18 | end, 19 | SilverMedal = function() 20 | return { 21 | BadgeTexture = "medal_silver", 22 | } 23 | end, 24 | Alert = function() 25 | return { 26 | BadgeTexture = "mp_alerttriangle", 27 | } 28 | end, 29 | Crown = function(Selected) 30 | return { 31 | BadgeTexture = "mp_hostcrown", 32 | BadgeColour = Selected and { R = 0, G = 0, B = 0, A = 255 } or { R = 255, G = 255, B = 255, A = 255 } 33 | } 34 | end, 35 | Ammo = function(Selected) 36 | return { 37 | BadgeTexture = Selected and "shop_ammo_icon_b" or "shop_ammo_icon_a", 38 | } 39 | end, 40 | Armour = function(Selected) 41 | return { 42 | BadgeTexture = Selected and "shop_armour_icon_b" or "shop_armour_icon_a", 43 | } 44 | end, 45 | Barber = function(Selected) 46 | return { 47 | BadgeTexture = Selected and "shop_barber_icon_b" or "shop_barber_icon_a", 48 | } 49 | end, 50 | Clothes = function(Selected) 51 | return { 52 | BadgeTexture = Selected and "shop_clothing_icon_b" or "shop_clothing_icon_a", 53 | } 54 | end, 55 | Franklin = function(Selected) 56 | return { 57 | BadgeTexture = Selected and "shop_franklin_icon_b" or "shop_franklin_icon_a", 58 | } 59 | end, 60 | Bike = function(Selected) 61 | return { 62 | BadgeTexture = Selected and "shop_garage_bike_icon_b" or "shop_garage_bike_icon_a", 63 | } 64 | end, 65 | Car = function(Selected) 66 | return { 67 | BadgeTexture = Selected and "shop_garage_icon_b" or "shop_garage_icon_a", 68 | } 69 | end, 70 | Boat = function(Selected) 71 | return { 72 | BadgeTexture = Selected and "mp_specitem_boat_black" or "mp_specitem_boat", 73 | BadgeDictionary = "mpinventory" 74 | } 75 | end, 76 | Heli = function(Selected) 77 | return { 78 | BadgeTexture = Selected and "mp_specitem_heli_black" or "mp_specitem_heli", 79 | BadgeDictionary = "mpinventory" 80 | } 81 | end, 82 | Plane = function(Selected) 83 | return { 84 | BadgeTexture = Selected and "mp_specitem_plane_black" or "mp_specitem_plane", 85 | BadgeDictionary = "mpinventory" 86 | } 87 | end, 88 | BoatPickup = function(Selected) 89 | return { 90 | BadgeTexture = Selected and "mp_specitem_boatpickup_black" or "mp_specitem_boatpickup", 91 | BadgeDictionary = "mpinventory" 92 | } 93 | end, 94 | Card = function(Selected) 95 | return { 96 | BadgeTexture = Selected and "mp_specitem_keycard_black" or "mp_specitem_keycard", 97 | BadgeDictionary = "mpinventory" 98 | } 99 | end, 100 | Gun = function(Selected) 101 | return { 102 | BadgeTexture = Selected and "shop_gunclub_icon_b" or "shop_gunclub_icon_a", 103 | } 104 | end, 105 | Heart = function(Selected) 106 | return { 107 | BadgeTexture = Selected and "shop_health_icon_b" or "shop_health_icon_a", 108 | } 109 | end, 110 | Makeup = function(Selected) 111 | return { 112 | BadgeTexture = Selected and "shop_makeup_icon_b" or "shop_makeup_icon_a", 113 | } 114 | end, 115 | Mask = function(Selected) 116 | return { 117 | BadgeTexture = Selected and "shop_mask_icon_b" or "shop_mask_icon_a", 118 | } 119 | end, 120 | Michael = function(Selected) 121 | return { 122 | BadgeTexture = Selected and "shop_michael_icon_b" or "shop_michael_icon_a", 123 | } 124 | end, 125 | Star = function() 126 | return { 127 | BadgeTexture = "shop_new_star", 128 | } 129 | end, 130 | Tattoo = function(Selected) 131 | return { 132 | BadgeTexture = Selected and "shop_tattoos_icon_b" or "shop_tattoos_icon_a", 133 | } 134 | end, 135 | Trevor = function(Selected) 136 | return { 137 | BadgeTexture = Selected and "shop_trevor_icon_b" or "shop_trevor_icon_a", 138 | } 139 | end, 140 | Lock = function(Selected) 141 | return { 142 | BadgeTexture = "shop_lock", 143 | BadgeColour = Selected and { R = 0, G = 0, B = 0, A = 255 } or { R = 255, G = 255, B = 255, A = 255 } 144 | } 145 | end, 146 | Tick = function(Selected) 147 | return { 148 | BadgeTexture = "shop_tick_icon", 149 | BadgeColour = Selected and { R = 0, G = 0, B = 0, A = 255 } or { R = 255, G = 255, B = 255, A = 255 } 150 | } 151 | end, 152 | Key = function(Selected) 153 | return { 154 | BadgeTexture = Selected and "mp_specitem_cuffkeys_black" or "mp_specitem_cuffkeys", 155 | BadgeDictionary = "mpinventory" 156 | } 157 | end, 158 | Coke = function(Selected) 159 | return { 160 | BadgeTexture = Selected and "mp_specitem_coke_black" or "mp_specitem_coke", 161 | BadgeDictionary = "mpinventory" 162 | } 163 | end, 164 | Heroin = function(Selected) 165 | return { 166 | BadgeTexture = Selected and "mp_specitem_heroin_black" or "mp_specitem_heroin", 167 | BadgeDictionary = "mpinventory" 168 | } 169 | end, 170 | Meth = function(Selected) 171 | return { 172 | BadgeTexture = Selected and "mp_specitem_meth_black" or "mp_specitem_meth", 173 | BadgeDictionary = "mpinventory" 174 | } 175 | end, 176 | Weed = function(Selected) 177 | return { 178 | BadgeTexture = Selected and "mp_specitem_weed_black" or "mp_specitem_weed", 179 | BadgeDictionary = "mpinventory" 180 | } 181 | end, 182 | Package = function(Selected) 183 | return { 184 | BadgeTexture = Selected and "mp_specitem_package_black" or "mp_specitem_package", 185 | BadgeDictionary = "mpinventory" 186 | } 187 | end, 188 | Cash = function(Selected) 189 | return { 190 | BadgeTexture = Selected and "mp_specitem_cash_black" or "mp_specitem_cash", 191 | BadgeDictionary = "mpinventory" 192 | } 193 | end, 194 | RP = function(Selected) 195 | return { 196 | BadgeTexture = "mp_anim_rp", 197 | BadgeDictionary = "mphud" 198 | } 199 | end, 200 | LSPD = function() 201 | return { 202 | BadgeTexture = "mpgroundlogo_cops", 203 | BadgeDictionary = "3dtextures" 204 | } 205 | end, 206 | Vagos = function() 207 | return { 208 | BadgeTexture = "mpgroundlogo_vagos", 209 | BadgeDictionary = "3dtextures" 210 | } 211 | end, 212 | Bikers = function() 213 | return { 214 | BadgeTexture = "mpgroundlogo_bikers", 215 | BadgeDictionary = "3dtextures" 216 | } 217 | end, 218 | 219 | -- CASINO 220 | Badbeat = function() 221 | return { 222 | BadgeTexture = "badbeat", 223 | BadgeDictionary = "mpawardcasino" 224 | } 225 | end, 226 | CashingOut = function() 227 | return { 228 | BadgeTexture = "cashingout", 229 | BadgeDictionary = "mpawardcasino" 230 | } 231 | end, 232 | FullHouse = function() 233 | return { 234 | BadgeTexture = "fullhouse", 235 | BadgeDictionary = "mpawardcasino" 236 | } 237 | end, 238 | HighRoller = function() 239 | return { 240 | BadgeTexture = "highroller", 241 | BadgeDictionary = "mpawardcasino" 242 | } 243 | end, 244 | HouseKeeping = function() 245 | return { 246 | BadgeTexture = "housekeeping", 247 | BadgeDictionary = "mpawardcasino" 248 | } 249 | end, 250 | LooseCheng = function() 251 | return { 252 | BadgeTexture = "loosecheng", 253 | BadgeDictionary = "mpawardcasino" 254 | } 255 | end, 256 | LuckyLucky = function() 257 | return { 258 | BadgeTexture = "luckylucky", 259 | BadgeDictionary = "mpawardcasino" 260 | } 261 | end, 262 | PlayToWin = function() 263 | return { 264 | BadgeTexture = "playtowin", 265 | BadgeDictionary = "mpawardcasino" 266 | } 267 | end, 268 | StraightFlush = function() 269 | return { 270 | BadgeTexture = "straightflush", 271 | BadgeDictionary = "mpawardcasino" 272 | } 273 | end, 274 | StrongArmTactics = function() 275 | return { 276 | BadgeTexture = "strongarmtactics", 277 | BadgeDictionary = "mpawardcasino" 278 | } 279 | end, 280 | TopPair = function() 281 | return { 282 | BadgeTexture = "toppair", 283 | BadgeDictionary = "mpawardcasino" 284 | } 285 | end, 286 | } -------------------------------------------------------------------------------- /vendors/RageUI/menu/elements/ItemsColour.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- Generated by EmmyLua(https://github.com/EmmyLua) 3 | --- Created by Dylan Malandain. 4 | --- DateTime: 24/07/2019 02:26 5 | --- 6 | 7 | RageUI.ItemsColour = { 8 | PureWhite = { 255, 255, 255, 255 }, 9 | White = { 240, 240, 240, 255 }, 10 | Black = { 0, 0, 0, 255 }, 11 | Grey = { 155, 155, 155, 255 }, 12 | GreyLight = { 205, 205, 205, 255 }, 13 | GreyDark = { 77, 77, 77, 255 }, 14 | Red = { 224, 50, 50, 255 }, 15 | RedLight = { 240, 153, 153, 255 }, 16 | RedDark = { 112, 25, 25, 255 }, 17 | Blue = { 93, 182, 229, 255 }, 18 | BlueLight = { 174, 219, 242, 255 }, 19 | BlueDark = { 47, 92, 115, 255 }, 20 | Yellow = { 240, 200, 80, 255 }, 21 | YellowLight = { 254, 235, 169, 255 }, 22 | YellowDark = { 126, 107, 41, 255 }, 23 | Orange = { 255, 133, 85, 255 }, 24 | OrangeLight = { 255, 194, 170, 255 }, 25 | OrangeDark = { 127, 66, 42, 255 }, 26 | Green = { 114, 204, 114, 255 }, 27 | GreenLight = { 185, 230, 185, 255 }, 28 | GreenDark = { 57, 102, 57, 255 }, 29 | Purple = { 132, 102, 226, 255 }, 30 | PurpleLight = { 192, 179, 239, 255 }, 31 | PurpleDark = { 67, 57, 111, 255 }, 32 | Pink = { 203, 54, 148, 255 }, 33 | RadarHealth = { 53, 154, 71, 255 }, 34 | RadarArmour = { 93, 182, 229, 255 }, 35 | RadarDamage = { 235, 36, 39, 255 }, 36 | NetPlayer1 = { 194, 80, 80, 255 }, 37 | NetPlayer2 = { 156, 110, 175, 255 }, 38 | NetPlayer3 = { 255, 123, 196, 255 }, 39 | NetPlayer4 = { 247, 159, 123, 255 }, 40 | NetPlayer5 = { 178, 144, 132, 255 }, 41 | NetPlayer6 = { 141, 206, 167, 255 }, 42 | NetPlayer7 = { 113, 169, 175, 255 }, 43 | NetPlayer8 = { 211, 209, 231, 255 }, 44 | NetPlayer9 = { 144, 127, 153, 255 }, 45 | NetPlayer10 = { 106, 196, 191, 255 }, 46 | NetPlayer11 = { 214, 196, 153, 255 }, 47 | NetPlayer12 = { 234, 142, 80, 255 }, 48 | NetPlayer13 = { 152, 203, 234, 255 }, 49 | NetPlayer14 = { 178, 98, 135, 255 }, 50 | NetPlayer15 = { 144, 142, 122, 255 }, 51 | NetPlayer16 = { 166, 117, 94, 255 }, 52 | NetPlayer17 = { 175, 168, 168, 255 }, 53 | NetPlayer18 = { 232, 142, 155, 255 }, 54 | NetPlayer19 = { 187, 214, 91, 255 }, 55 | NetPlayer20 = { 12, 123, 86, 255 }, 56 | NetPlayer21 = { 123, 196, 255, 255 }, 57 | NetPlayer22 = { 171, 60, 230, 255 }, 58 | NetPlayer23 = { 206, 169, 13, 255 }, 59 | NetPlayer24 = { 71, 99, 173, 255 }, 60 | NetPlayer25 = { 42, 166, 185, 255 }, 61 | NetPlayer26 = { 186, 157, 125, 255 }, 62 | NetPlayer27 = { 201, 225, 255, 255 }, 63 | NetPlayer28 = { 240, 240, 150, 255 }, 64 | NetPlayer29 = { 237, 140, 161, 255 }, 65 | NetPlayer30 = { 249, 138, 138, 255 }, 66 | NetPlayer31 = { 252, 239, 166, 255 }, 67 | NetPlayer32 = { 240, 240, 240, 255 }, 68 | SimpleBlipDefault = { 159, 201, 166, 255 }, 69 | MenuBlue = { 140, 140, 140, 255 }, 70 | MenuGreyLight = { 140, 140, 140, 255 }, 71 | MenuBlueExtraDark = { 40, 40, 40, 255 }, 72 | MenuYellow = { 240, 160, 0, 255 }, 73 | MenuYellowDark = { 240, 160, 0, 255 }, 74 | MenuGreen = { 240, 160, 0, 255 }, 75 | MenuGrey = { 140, 140, 140, 255 }, 76 | MenuGreyDark = { 60, 60, 60, 255 }, 77 | MenuHighlight = { 30, 30, 30, 255 }, 78 | MenuStandard = { 140, 140, 140, 255 }, 79 | MenuDimmed = { 75, 75, 75, 255 }, 80 | MenuExtraDimmed = { 50, 50, 50, 255 }, 81 | BriefTitle = { 95, 95, 95, 255 }, 82 | MidGreyMp = { 100, 100, 100, 255 }, 83 | NetPlayer1Dark = { 93, 39, 39, 255 }, 84 | NetPlayer2Dark = { 77, 55, 89, 255 }, 85 | NetPlayer3Dark = { 124, 62, 99, 255 }, 86 | NetPlayer4Dark = { 120, 80, 80, 255 }, 87 | NetPlayer5Dark = { 87, 72, 66, 255 }, 88 | NetPlayer6Dark = { 74, 103, 83, 255 }, 89 | NetPlayer7Dark = { 60, 85, 88, 255 }, 90 | NetPlayer8Dark = { 105, 105, 64, 255 }, 91 | NetPlayer9Dark = { 72, 63, 76, 255 }, 92 | NetPlayer10Dark = { 53, 98, 95, 255 }, 93 | NetPlayer11Dark = { 107, 98, 76, 255 }, 94 | NetPlayer12Dark = { 117, 71, 40, 255 }, 95 | NetPlayer13Dark = { 76, 101, 117, 255 }, 96 | NetPlayer14Dark = { 65, 35, 47, 255 }, 97 | NetPlayer15Dark = { 72, 71, 61, 255 }, 98 | NetPlayer16Dark = { 85, 58, 47, 255 }, 99 | NetPlayer17Dark = { 87, 84, 84, 255 }, 100 | NetPlayer18Dark = { 116, 71, 77, 255 }, 101 | NetPlayer19Dark = { 93, 107, 45, 255 }, 102 | NetPlayer20Dark = { 6, 61, 43, 255 }, 103 | NetPlayer21Dark = { 61, 98, 127, 255 }, 104 | NetPlayer22Dark = { 85, 30, 115, 255 }, 105 | NetPlayer23Dark = { 103, 84, 6, 255 }, 106 | NetPlayer24Dark = { 35, 49, 86, 255 }, 107 | NetPlayer25Dark = { 21, 83, 92, 255 }, 108 | NetPlayer26Dark = { 93, 98, 62, 255 }, 109 | NetPlayer27Dark = { 100, 112, 127, 255 }, 110 | NetPlayer28Dark = { 120, 120, 75, 255 }, 111 | NetPlayer29Dark = { 152, 76, 93, 255 }, 112 | NetPlayer30Dark = { 124, 69, 69, 255 }, 113 | NetPlayer31Dark = { 10, 43, 50, 255 }, 114 | NetPlayer32Dark = { 95, 95, 10, 255 }, 115 | Bronze = { 180, 130, 97, 255 }, 116 | Silver = { 150, 153, 161, 255 }, 117 | Gold = { 214, 181, 99, 255 }, 118 | Platinum = { 166, 221, 190, 255 }, 119 | Gang1 = { 29, 100, 153, 255 }, 120 | Gang2 = { 214, 116, 15, 255 }, 121 | Gang3 = { 135, 125, 142, 255 }, 122 | Gang4 = { 229, 119, 185, 255 }, 123 | SameCrew = { 252, 239, 166, 255 }, 124 | Freemode = { 45, 110, 185, 255 }, 125 | PauseBg = { 0, 0, 0, 255 }, 126 | Friendly = { 93, 182, 229, 255 }, 127 | Enemy = { 194, 80, 80, 255 }, 128 | Location = { 240, 200, 80, 255 }, 129 | Pickup = { 114, 204, 114, 255 }, 130 | PauseSingleplayer = { 114, 204, 114, 255 }, 131 | FreemodeDark = { 22, 55, 92, 255 }, 132 | InactiveMission = { 154, 154, 154, 255 }, 133 | Damage = { 194, 80, 80, 255 }, 134 | PinkLight = { 252, 115, 201, 255 }, 135 | PmMitemHighlight = { 252, 177, 49, 255 }, 136 | ScriptVariable = { 0, 0, 0, 255 }, 137 | Yoga = { 109, 247, 204, 255 }, 138 | Tennis = { 241, 101, 34, 255 }, 139 | Golf = { 214, 189, 97, 255 }, 140 | ShootingRange = { 112, 25, 25, 255 }, 141 | FlightSchool = { 47, 92, 115, 255 }, 142 | NorthBlue = { 93, 182, 229, 255 }, 143 | SocialClub = { 234, 153, 28, 255 }, 144 | PlatformBlue = { 11, 55, 123, 255 }, 145 | PlatformGreen = { 146, 200, 62, 255 }, 146 | PlatformGrey = { 234, 153, 28, 255 }, 147 | FacebookBlue = { 66, 89, 148, 255 }, 148 | IngameBg = { 0, 0, 0, 255 }, 149 | Darts = { 114, 204, 114, 255 }, 150 | Waypoint = { 164, 76, 242, 255 }, 151 | Michael = { 101, 180, 212, 255 }, 152 | Franklin = { 171, 237, 171, 255 }, 153 | Trevor = { 255, 163, 87, 255 }, 154 | GolfP1 = { 240, 240, 240, 255 }, 155 | GolfP2 = { 235, 239, 30, 255 }, 156 | GolfP3 = { 255, 149, 14, 255 }, 157 | GolfP4 = { 246, 60, 161, 255 }, 158 | WaypointLight = { 210, 166, 249, 255 }, 159 | WaypointDark = { 82, 38, 121, 255 }, 160 | PanelLight = { 0, 0, 0, 255 }, 161 | MichaelDark = { 72, 103, 116, 255 }, 162 | FranklinDark = { 85, 118, 85, 255 }, 163 | TrevorDark = { 127, 81, 43, 255 }, 164 | ObjectiveRoute = { 240, 200, 80, 255 }, 165 | PausemapTint = { 0, 0, 0, 255 }, 166 | PauseDeselect = { 100, 100, 100, 255 }, 167 | PmWeaponsPurchasable = { 45, 110, 185, 255 }, 168 | PmWeaponsLocked = { 240, 240, 240, 255 }, 169 | ScreenBg = { 0, 0, 0, 255 }, 170 | Chop = { 224, 50, 50, 255 }, 171 | PausemapTintHalf = { 0, 0, 0, 255 }, 172 | NorthBlueOfficial = { 0, 71, 133, 255 }, 173 | ScriptVariable2 = { 0, 0, 0, 255 }, 174 | H = { 33, 118, 37, 255 }, 175 | HDark = { 37, 102, 40, 255 }, 176 | T = { 234, 153, 28, 255 }, 177 | TDark = { 225, 140, 8, 255 }, 178 | HShard = { 20, 40, 0, 255 }, 179 | ControllerMichael = { 48, 255, 255, 255 }, 180 | ControllerFranklin = { 48, 255, 0, 255 }, 181 | ControllerTrevor = { 176, 80, 0, 255 }, 182 | ControllerChop = { 127, 0, 0, 255 }, 183 | VideoEditorVideo = { 53, 166, 224, 255 }, 184 | VideoEditorAudio = { 162, 79, 157, 255 }, 185 | VideoEditorText = { 104, 192, 141, 255 }, 186 | HbBlue = { 29, 100, 153, 255 }, 187 | HbYellow = { 234, 153, 28, 255 }, 188 | VideoEditorScore = { 240, 160, 1, 255 }, 189 | VideoEditorAudioFadeout = { 59, 34, 57, 255 }, 190 | VideoEditorTextFadeout = { 41, 68, 53, 255 }, 191 | VideoEditorScoreFadeout = { 82, 58, 10, 255 }, 192 | HeistBackground = { 37, 102, 40, 255 }, 193 | VideoEditorAmbient = { 240, 200, 80, 255 }, 194 | VideoEditorAmbientFadeout = { 80, 70, 34, 255 }, 195 | Gb = { 255, 133, 85, 255 }, 196 | G = { 255, 194, 170, 255 }, 197 | B = { 255, 133, 85, 255 }, 198 | LowFlow = { 240, 200, 80, 255 }, 199 | LowFlowDark = { 126, 107, 41, 255 }, 200 | G1 = { 247, 159, 123, 255 }, 201 | G2 = { 226, 134, 187, 255 }, 202 | G3 = { 239, 238, 151, 255 }, 203 | G4 = { 113, 169, 175, 255 }, 204 | G5 = { 160, 140, 193, 255 }, 205 | G6 = { 141, 206, 167, 255 }, 206 | G7 = { 181, 214, 234, 255 }, 207 | G8 = { 178, 144, 132, 255 }, 208 | G9 = { 0, 132, 114, 255 }, 209 | G10 = { 216, 85, 117, 255 }, 210 | G11 = { 30, 100, 152, 255 }, 211 | G12 = { 43, 181, 117, 255 }, 212 | G13 = { 233, 141, 79, 255 }, 213 | G14 = { 137, 210, 215, 255 }, 214 | G15 = { 134, 125, 141, 255 }, 215 | Adversary = { 109, 34, 33, 255 }, 216 | DegenRed = { 255, 0, 0, 255 }, 217 | DegenYellow = { 255, 255, 0, 255 }, 218 | DegenGreen = { 0, 255, 0, 255 }, 219 | DegenCyan = { 0, 255, 255, 255 }, 220 | DegenBlue = { 0, 0, 255, 255 }, 221 | DegenMagenta = { 255, 0, 255, 255 }, 222 | Stunt1 = { 38, 136, 234, 255 }, 223 | Stunt2 = { 224, 50, 50, 255 }, 224 | } 225 | 226 | -------------------------------------------------------------------------------- /vendors/RageUI/menu/items/UIButton.lua: -------------------------------------------------------------------------------- 1 | ---@type table 2 | local SettingsButton = { 3 | Rectangle = { Y = 0, Width = 431, Height = 38 }, 4 | Text = { X = 8, Y = 3, Scale = 0.33 }, 5 | LeftBadge = { Y = -2, Width = 40, Height = 40 }, 6 | RightBadge = { X = 385, Y = -2, Width = 40, Height = 40 }, 7 | RightText = { X = 420, Y = 4, Scale = 0.35 }, 8 | SelectedSprite = { Dictionary = "commonmenu", Texture = "gradient_nav", Y = 0, Width = 431, Height = 38 }, 9 | } 10 | 11 | ---Button 12 | ---@param Label string 13 | ---@param Description string 14 | ---@param Enabled boolean 15 | ---@param Callback function 16 | ---@param Submenu table 17 | ---@return nil 18 | ---@public 19 | function RageUI.Button(Label, Description, Enabled, Callback, Submenu) 20 | local CurrentMenu = RageUI.CurrentMenu 21 | if CurrentMenu ~= nil and CurrentMenu() then 22 | ---@type number 23 | local Option = RageUI.Options + 1 24 | 25 | if CurrentMenu.Pagination.Minimum <= Option and CurrentMenu.Pagination.Maximum >= Option then 26 | ---@type boolean 27 | local Active = CurrentMenu.Index == Option 28 | 29 | RageUI.ItemsSafeZone(CurrentMenu) 30 | 31 | if Active then 32 | RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height) 33 | end 34 | 35 | local colorData = Enabled and (Active and { 0, 0, 0 } or { 255, 255, 255 }) or { 163, 159, 148 } 36 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, colorData[1], colorData[2], colorData[3], 255) 37 | 38 | RageUI.ItemOffset = RageUI.ItemOffset + SettingsButton.Rectangle.Height 39 | 40 | RageUI.ItemsDescription(CurrentMenu, Description, Active); 41 | 42 | if Enabled then 43 | ---@type boolean 44 | local Hovered = CurrentMenu.EnableMouse and (CurrentMenu.CursorStyle == 0 or CurrentMenu.CursorStyle == 1) and RageUI.ItemsMouseBounds(CurrentMenu, Active, Option + 1, SettingsButton); 45 | local Selected = (CurrentMenu.Controls.Select.Active or (Hovered and CurrentMenu.Controls.Click.Active)) and Active 46 | 47 | if Callback then 48 | Callback(Hovered, Active, Selected) 49 | end 50 | 51 | if Selected then 52 | local Audio = RageUI.Settings.Audio 53 | RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef) 54 | 55 | if Submenu and Submenu() then 56 | RageUI.NextMenu = Submenu 57 | end 58 | end 59 | end 60 | end 61 | 62 | RageUI.Options = RageUI.Options + 1 63 | end 64 | end 65 | 66 | ---ButtonWithStyle 67 | ---@param Label string 68 | ---@param Description string 69 | ---@param Style table 70 | ---@param Enabled boolean 71 | ---@param Callback function 72 | ---@param Submenu table 73 | ---@return nil 74 | ---@public 75 | function RageUI.ButtonWithStyle(Label, Description, Style, Enabled, Callback, Submenu) 76 | local CurrentMenu = RageUI.CurrentMenu 77 | if CurrentMenu ~= nil and CurrentMenu() then 78 | ---@type number 79 | local Option = RageUI.Options + 1 80 | 81 | if CurrentMenu.Pagination.Minimum <= Option and CurrentMenu.Pagination.Maximum >= Option then 82 | ---@type boolean 83 | local Active = CurrentMenu.Index == Option 84 | 85 | RageUI.ItemsSafeZone(CurrentMenu) 86 | 87 | local haveLeftBadge = Style.LeftBadge and Style.LeftBadge ~= RageUI.BadgeStyle.None 88 | local haveRightBadge = (Style.RightBadge and Style.RightBadge ~= RageUI.BadgeStyle.None) or (not Enabled and Style.LockBadge ~= RageUI.BadgeStyle.None) 89 | 90 | local LeftBadgeOffset = haveLeftBadge and 27 or 0 91 | local RightBadgeOffset = haveRightBadge and 32 or 0 92 | 93 | if Style.Color and Style.Color.BackgroundColor then 94 | RenderRectangle(CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height, Style.Color.BackgroundColor[1], Style.Color.BackgroundColor[2], Style.Color.BackgroundColor[3]) 95 | end 96 | 97 | if Active then 98 | if Style.Color and Style.Color.HightLightColor then 99 | RenderRectangle(CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height, Style.Color.HightLightColor[1], Style.Color.HightLightColor[2], Style.Color.HightLightColor[3]) 100 | else 101 | RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height) 102 | end 103 | end 104 | 105 | if Enabled then 106 | if haveLeftBadge then 107 | local LeftBadge = Style.LeftBadge(Active) 108 | RenderSprite(LeftBadge.BadgeDictionary or "commonmenu", LeftBadge.BadgeTexture or "", CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, 0, LeftBadge.BadgeColour and LeftBadge.BadgeColour.R or 255, LeftBadge.BadgeColour and LeftBadge.BadgeColour.G or 255, LeftBadge.BadgeColour and LeftBadge.BadgeColour.B or 255, LeftBadge.BadgeColour and LeftBadge.BadgeColour.A or 255) 109 | end 110 | 111 | if haveRightBadge then 112 | local RightBadge = Style.RightBadge(Active) 113 | RenderSprite(RightBadge.BadgeDictionary or "commonmenu", RightBadge.BadgeTexture or "", CurrentMenu.X + SettingsButton.RightBadge.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.RightBadge.Width, SettingsButton.RightBadge.Height, 0, RightBadge.BadgeColour and RightBadge.BadgeColour.R or 255, RightBadge.BadgeColour and RightBadge.BadgeColour.G or 255, RightBadge.BadgeColour and RightBadge.BadgeColour.B or 255, RightBadge.BadgeColour and RightBadge.BadgeColour.A or 255) 114 | end 115 | 116 | if Style.RightLabel then 117 | RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, Active and 0 or 245, Active and 0 or 245, Active and 0 or 245, 255, 2) 118 | end 119 | 120 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, Active and 0 or 245, Active and 0 or 245, Active and 0 or 245, 255) 121 | else 122 | if haveRightBadge then 123 | local RightBadge = RageUI.BadgeStyle.Lock(Active) 124 | RenderSprite(RightBadge.BadgeDictionary or "commonmenu", RightBadge.BadgeTexture or "", CurrentMenu.X + SettingsButton.RightBadge.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.RightBadge.Width, SettingsButton.RightBadge.Height, 0, RightBadge.BadgeColour and RightBadge.BadgeColour.R or 255, RightBadge.BadgeColour and RightBadge.BadgeColour.G or 255, RightBadge.BadgeColour and RightBadge.BadgeColour.B or 255, RightBadge.BadgeColour and RightBadge.BadgeColour.A or 255) 125 | end 126 | 127 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 163, 159, 148, 255) 128 | end 129 | 130 | RageUI.ItemOffset = RageUI.ItemOffset + SettingsButton.Rectangle.Height 131 | 132 | RageUI.ItemsDescription(CurrentMenu, Description, Active); 133 | 134 | if Enabled then 135 | ---@type boolean 136 | local Hovered = CurrentMenu.EnableMouse and (CurrentMenu.CursorStyle == 0 or CurrentMenu.CursorStyle == 1) and RageUI.ItemsMouseBounds(CurrentMenu, Active, Option + 1, SettingsButton); 137 | local Selected = (CurrentMenu.Controls.Select.Active or (Hovered and CurrentMenu.Controls.Click.Active)) and Active 138 | 139 | if Callback then 140 | Callback(Hovered, Active, Selected) 141 | end 142 | 143 | if Selected then 144 | local Audio = RageUI.Settings.Audio 145 | RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef) 146 | 147 | if Submenu and Submenu() then 148 | RageUI.NextMenu = Submenu 149 | end 150 | end 151 | end 152 | 153 | end 154 | 155 | RageUI.Options = RageUI.Options + 1 156 | end 157 | end 158 | -------------------------------------------------------------------------------- /client/main.lua: -------------------------------------------------------------------------------- 1 | ESX, isMenuActive, canInteractWithZone, interactWithServer = nil, false, true, false 2 | 3 | cryptoValues = {} 4 | 5 | local function countTable(table) 6 | local i = 0 7 | for _,_ in pairs(table) do 8 | i = i + 1 9 | end 10 | return i 11 | end 12 | 13 | local function customGroupDigits(value) 14 | local left,num,right = string.match(value,'^([^%d]*%d)(%d*)(.-)$') 15 | 16 | return left..(num:reverse():gsub('(%d%d%d)','%1' .. "."):reverse())..right 17 | end 18 | 19 | local function showbox(TextEntry, ExampleText, MaxStringLenght, isValueInt) 20 | AddTextEntry('FMMC_KEY_TIP1', TextEntry) 21 | DisplayOnscreenKeyboard(1, "FMMC_KEY_TIP1", "", ExampleText, "", "", "", MaxStringLenght) 22 | local blockinput = true 23 | while UpdateOnscreenKeyboard() ~= 1 and UpdateOnscreenKeyboard() ~= 2 do 24 | Wait(0) 25 | end 26 | if UpdateOnscreenKeyboard() ~= 2 then 27 | local result = GetOnscreenKeyboardResult() 28 | Wait(500) 29 | blockinput = false 30 | if isValueInt then 31 | local isNumber = tonumber(result) 32 | if isNumber and tonumber(result) > 0 then 33 | return result 34 | else 35 | return nil 36 | end 37 | end 38 | 39 | return result 40 | else 41 | Wait(500) 42 | blockinput = false 43 | return nil 44 | end 45 | end 46 | 47 | local function generateCryptoValue(value, isPositive) 48 | if isPositive == nil then 49 | return "~o~"..customGroupDigits(value).."$ ~s~[~o~=~s~]" 50 | end 51 | return (isPositive and "~g~" or "~r~")..customGroupDigits(value).."$ ~s~["..(isPositive and "~g~↑" or "~r~↓").."~s~]" 52 | end 53 | 54 | local function sub(subName) 55 | return "crypto_"..subName 56 | end 57 | 58 | local function generateCryptoSelectTitle(ammount) 59 | if ammount > 0 then 60 | return "~s~: ~y~x"..customGroupDigits(ammount).."" 61 | else 62 | return "~s~: ~b~Définir" 63 | end 64 | end 65 | 66 | local function createMenuPanes() 67 | local title, desc = "Cryptomonnaies", "~g~Gérez vos cryptomonnaies" 68 | RMenu.Add("crypto", sub("main"), RageUI.CreateMenu(title, desc, nil, nil, "pablo", "black")) 69 | RMenu:Get("crypto", sub("main")).Closed = function() 70 | end 71 | 72 | RMenu.Add("crypto", sub("sell"), RageUI.CreateSubMenu(RMenu:Get("crypto", sub("main")), title, desc, nil, nil, "pablo", "black")) 73 | RMenu:Get("crypto", sub("sell")).Closed = function() 74 | end 75 | 76 | RMenu.Add("crypto", sub("buy"), RageUI.CreateSubMenu(RMenu:Get("crypto", sub("main")), title, desc, nil, nil, "pablo", "black")) 77 | RMenu:Get("crypto", sub("buy")).Closed = function() 78 | end 79 | end 80 | 81 | Citizen.CreateThread(function() 82 | TriggerEvent(Config.esxGetter, function(obj) 83 | ESX = obj 84 | end) 85 | 86 | createMenuPanes() 87 | 88 | local interactZone = Config.position 89 | if Config.blip then 90 | local blip = AddBlipForCoord(interactZone) 91 | SetBlipAsShortRange(blip, true) 92 | SetBlipScale(blip, 0.9) 93 | SetBlipSprite(blip, 58) 94 | SetBlipColour(blip, 28) 95 | BeginTextCommandSetBlipName("STRING") 96 | AddTextComponentString("Cryptomonnaies") 97 | EndTextCommandSetBlipName(blip) 98 | end 99 | 100 | while true do 101 | local interval = 250 102 | local playerPos = GetEntityCoords(PlayerPedId()) 103 | local dst = #(interactZone-playerPos) 104 | if dst <= 30.0 and canInteractWithZone then 105 | interval = 0 106 | DrawMarker(22, interactZone, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.45, 0.45, 0.45, 255, 0, 0, 255, 55555, false, true, 2, false, false, false, false) 107 | if dst <= 1.0 then 108 | ESX.ShowHelpNotification("Appuyez sur ~INPUT_CONTEXT~ pour gérer vos cryptomonnaies") 109 | if IsControlJustPressed(0, 51) and not isMenuActive then 110 | canInteractWithZone = false 111 | TriggerServerEvent("crypto:openCryptoMenu") 112 | end 113 | end 114 | end 115 | Wait(interval) 116 | end 117 | end) 118 | 119 | RegisterNetEvent("cryptos:cbMoney") 120 | RegisterNetEvent("cryptos:cbWallet") 121 | RegisterNetEvent("crypto:cbOpenMenu") 122 | AddEventHandler("crypto:cbOpenMenu", function(incomingCryptoValues, playerMoney, cryptoWallet) 123 | FreezeEntityPosition(PlayerPedId(), true) 124 | canInteractWithZone = true 125 | cryptoValues = incomingCryptoValues 126 | isMenuActive = true 127 | RageUI.Visible(RMenu:Get("crypto", sub("main")), true) 128 | Citizen.CreateThread(function() 129 | AddEventHandler("cryptos:cbWallet", function(newWallet) 130 | cryptoWallet = newWallet 131 | end) 132 | AddEventHandler("cryptos:cbMoney", function(newMoney) 133 | playerMoney = newMoney 134 | end) 135 | local cryptoSelectedAmmount = {} 136 | local function resetCryptoSelectedAmmount() 137 | for k,v in pairs(cryptoValues) do 138 | cryptoSelectedAmmount[k] = 0 139 | end 140 | end 141 | resetCryptoSelectedAmmount() 142 | while isMenuActive do 143 | local shouldStayOpened = false 144 | local function tick() 145 | shouldStayOpened = true 146 | end 147 | RageUI.IsVisible(RMenu:Get("crypto", sub("main")), true, true, true, function() 148 | RageUI.Separator("Liquide: ~g~"..ESX.Math.GroupDigits(playerMoney[1]).."$ ~s~| Banque: ~b~"..ESX.Math.GroupDigits(playerMoney[2]).."$") 149 | RageUI.Separator("↓ ~g~Gestion ~s~↓") 150 | RageUI.ButtonWithStyle("Vendre mes cryptomonnaies", nil, {RightLabel = "→→"}, true, function() resetCryptoSelectedAmmount() end, RMenu:Get("crypto", sub("sell"))) 151 | RageUI.ButtonWithStyle("Acheter des cryptomonnaies", nil, {RightLabel = "→→"}, true, function() resetCryptoSelectedAmmount() end, RMenu:Get("crypto", sub("buy"))) 152 | if countTable(cryptoValues) > 0 then 153 | RageUI.Separator("↓ ~y~Les cryptos ~s~↓") 154 | for cryptoName,cryptoData in pairs(cryptoValues) do 155 | RageUI.ButtonWithStyle(cryptoData.label, nil, {RightLabel = generateCryptoValue(cryptoData.value, cryptoData.positive)}, true) 156 | end 157 | end 158 | tick() 159 | end, function() 160 | end) 161 | 162 | RageUI.IsVisible(RMenu:Get("crypto", sub("sell")), true, true, true, function() 163 | RageUI.Separator("Liquide: ~g~"..ESX.Math.GroupDigits(playerMoney[1]).."$ ~s~| Banque: ~b~"..ESX.Math.GroupDigits(playerMoney[2]).."$") 164 | RageUI.Separator("↓ ~g~Vente de cryptos ~s~↓") 165 | for cryptoName,cryptoData in pairs(cryptoValues) do 166 | if (cryptoWallet[cryptoName] or 0) > 0 then 167 | RageUI.ButtonWithStyle(cryptoData.label.." [~b~x"..cryptoWallet[cryptoName].."~s~]", "~y~Nom: ~s~"..cryptoData.label.."~n~~o~Valeur: ~s~"..customGroupDigits(cryptoData.value).."~g~$~n~~r~Total: ~s~"..(customGroupDigits(cryptoData.value*cryptoWallet[cryptoName])).."~g~$", {RightLabel = generateCryptoValue(cryptoData.value, cryptoData.positive)}, not interactWithServer, function(_,_,s) 168 | if s then 169 | local qty = showbox("Quantité", "", 50, true) 170 | if qty == nil then 171 | ESX.ShowNotification("~r~Quantité invalide") 172 | else 173 | interactWithServer = true 174 | TriggerServerEvent("crypto:sellCryptos", cryptoName, qty) 175 | end 176 | end 177 | end) 178 | end 179 | end 180 | tick() 181 | end, function() 182 | end) 183 | 184 | RageUI.IsVisible(RMenu:Get("crypto", sub("buy")), true, true, true, function() 185 | RageUI.Separator("Liquide: ~g~"..ESX.Math.GroupDigits(playerMoney[1]).."$ ~s~| Banque: ~b~"..ESX.Math.GroupDigits(playerMoney[2]).."$") 186 | RageUI.Separator("↓ ~g~Achat de cryptos ~s~↓") 187 | for cryptoName,cryptoData in pairs(cryptoValues) do 188 | RageUI.ButtonWithStyle(cryptoData.label.." [~b~x"..(cryptoWallet[cryptoName] or 0).."~s~]", "~y~Nom: ~s~"..cryptoData.label.."~n~~o~Valeur: ~s~"..customGroupDigits(cryptoData.value).."~g~$", {RightLabel = generateCryptoValue(cryptoData.value, cryptoData.positive)}, not interactWithServer, function(_,_,s) 189 | if s then 190 | local qty = showbox("Quantité", "", 50, true) 191 | if qty == nil then 192 | ESX.ShowNotification("~r~Quantité invalide") 193 | else 194 | interactWithServer = true 195 | TriggerServerEvent("crypto:buyCryptos", cryptoName, qty) 196 | end 197 | end 198 | end) 199 | end 200 | tick() 201 | end, function() 202 | end) 203 | 204 | if not shouldStayOpened and isMenuActive then 205 | TriggerServerEvent("crypto:closeCryptoMenu") 206 | FreezeEntityPosition(PlayerPedId(), false) 207 | isMenuActive = false 208 | end 209 | Wait(0) 210 | end 211 | end) 212 | end) 213 | 214 | RegisterNetEvent("crypto:updateCryptoValue") 215 | AddEventHandler("crypto:updateCryptoValue", function(incomingCryptoValues) 216 | cryptoValues = incomingCryptoValues 217 | end) 218 | 219 | RegisterNetEvent("crypto:cbServer") 220 | AddEventHandler("crypto:cbServer", function(message) 221 | interactWithServer = false 222 | if message ~= nil then ESX.ShowNotification(message) end 223 | end) -------------------------------------------------------------------------------- /vendors/RageUI/menu/items/UIList.lua: -------------------------------------------------------------------------------- 1 | ---@type table 2 | local SettingsButton = { 3 | Rectangle = { Y = 0, Width = 431, Height = 38 }, 4 | Text = { X = 8, Y = 3, Scale = 0.33 }, 5 | LeftBadge = { Y = -2, Width = 40, Height = 40 }, 6 | RightBadge = { X = 385, Y = -2, Width = 40, Height = 40 }, 7 | RightText = { X = 420, Y = 4, Scale = 0.35 }, 8 | SelectedSprite = { Dictionary = "commonmenu", Texture = "gradient_nav", Y = 0, Width = 431, Height = 38 }, 9 | } 10 | 11 | ---@type table 12 | local SettingsList = { 13 | LeftArrow = { Dictionary = "commonmenu", Texture = "arrowleft", X = 378, Y = 3, Width = 30, Height = 30 }, 14 | RightArrow = { Dictionary = "commonmenu", Texture = "arrowright", X = 400, Y = 3, Width = 30, Height = 30 }, 15 | Text = { X = 403, Y = 3, Scale = 0.35 }, 16 | } 17 | 18 | ---List 19 | ---@param Label string 20 | ---@param Items table 21 | ---@param Index number 22 | ---@param Description string 23 | ---@param Enabled boolean 24 | ---@param Callback function 25 | ---@return nil 26 | ---@public 27 | function RageUI.List(Label, Items, Index, Description, Style, Enabled, Callback, onListChange, Submenu) 28 | ---@type table 29 | local CurrentMenu = RageUI.CurrentMenu; 30 | 31 | if CurrentMenu ~= nil then 32 | if CurrentMenu() then 33 | 34 | ---@type number 35 | local Option = RageUI.Options + 1 36 | 37 | if CurrentMenu.Pagination.Minimum <= Option and CurrentMenu.Pagination.Maximum >= Option then 38 | 39 | ---@type number 40 | local Selected = CurrentMenu.Index == Option 41 | 42 | ---@type boolean 43 | local LeftArrowHovered, RightArrowHovered = false, false 44 | 45 | RageUI.ItemsSafeZone(CurrentMenu) 46 | 47 | local Hovered = false; 48 | local LeftBadgeOffset = ((Style.LeftBadge == RageUI.BadgeStyle.None or Style.LeftBadge == nil) and 0 or 27) 49 | local RightBadgeOffset = ((Style.RightBadge == RageUI.BadgeStyle.None or Style.RightBadge == nil) and 0 or 32) 50 | local RightOffset = 0 51 | ---@type boolean 52 | if CurrentMenu.EnableMouse == true and (CurrentMenu.CursorStyle == 0) or (CurrentMenu.CursorStyle == 1) then 53 | Hovered = RageUI.ItemsMouseBounds(CurrentMenu, Selected, Option, SettingsButton); 54 | end 55 | local ListText = (type(Items[Index]) == "table") and string.format("← %s →", Items[Index].Name) or string.format("← %s →", Items[Index]) or "NIL" 56 | 57 | if Selected then 58 | RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height) 59 | end 60 | if Enabled == true or Enabled == nil then 61 | if Selected then 62 | if Style.RightLabel ~= nil and Style.RightLabel ~= "" then 63 | RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 0, 0, 0, 255, 2) 64 | RightOffset = MeasureStringWidth(Style.RightLabel, 0, 0.35) 65 | end 66 | else 67 | if Style.RightLabel ~= nil and Style.RightLabel ~= "" then 68 | RightOffset = MeasureStringWidth(Style.RightLabel, 0, 0.35) 69 | RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 245, 245, 245, 255, 2) 70 | end 71 | end 72 | end 73 | RightOffset = RightBadgeOffset * 1.3 + RightOffset 74 | if Enabled == true or Enabled == nil then 75 | if Selected then 76 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 0, 0, 0, 255) 77 | RenderText(ListText, CurrentMenu.X + SettingsList.Text.X + 15 + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsList.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsList.Text.Scale, 0, 0, 0, 255, 2) 78 | else 79 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 245, 245, 245, 255) 80 | RenderText(ListText, CurrentMenu.X + SettingsList.Text.X + 15 + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsList.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsList.Text.Scale, 245, 245, 245, 255, 2) 81 | end 82 | else 83 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 163, 159, 148, 255) 84 | if Selected then 85 | RenderText(ListText, CurrentMenu.X + SettingsList.Text.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsList.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsList.Text.Scale, 163, 159, 148, 255, 2) 86 | else 87 | RenderText(ListText, CurrentMenu.X + SettingsList.Text.X + 15 + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsList.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsList.Text.Scale, 163, 159, 148, 255, 2) 88 | end 89 | end 90 | 91 | if type(Style) == "table" then 92 | if Style.Enabled == true or Style.Enabled == nil then 93 | if type(Style) == 'table' then 94 | if Style.LeftBadge ~= nil then 95 | if Style.LeftBadge ~= RageUI.BadgeStyle.None then 96 | local BadgeData = Style.LeftBadge(Selected) 97 | 98 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, 0, BadgeData.BadgeColour and BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.A or 255) 99 | end 100 | end 101 | 102 | if Style.RightBadge ~= nil then 103 | if Style.RightBadge ~= RageUI.BadgeStyle.None then 104 | local BadgeData = Style.RightBadge(Selected) 105 | 106 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X + SettingsButton.RightBadge.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.RightBadge.Width, SettingsButton.RightBadge.Height, 0, BadgeData.BadgeColour and BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.A or 255) 107 | end 108 | end 109 | end 110 | else 111 | ---@type table 112 | local LeftBadge = RageUI.BadgeStyle.Lock 113 | ---@type number 114 | if LeftBadge ~= RageUI.BadgeStyle.None and LeftBadge ~= nil then 115 | local BadgeData = LeftBadge(Selected) 116 | 117 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, 0, BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour.A or 255) 118 | end 119 | end 120 | else 121 | error("UICheckBox Style is not a `table`") 122 | end 123 | 124 | RageUI.ItemOffset = RageUI.ItemOffset + SettingsButton.Rectangle.Height 125 | 126 | RageUI.ItemsDescription(CurrentMenu, Description, Selected); 127 | 128 | if Selected and (CurrentMenu.Controls.Left.Active or (CurrentMenu.Controls.Click.Active and LeftArrowHovered)) and not (CurrentMenu.Controls.Right.Active or (CurrentMenu.Controls.Click.Active and RightArrowHovered)) then 129 | Index = Index - 1 130 | if Index < 1 then 131 | Index = #Items 132 | end 133 | if (onListChange ~= nil) then 134 | onListChange(Index, Items[Index]); 135 | end 136 | local Audio = RageUI.Settings.Audio 137 | RageUI.PlaySound(Audio[Audio.Use].LeftRight.audioName, Audio[Audio.Use].LeftRight.audioRef) 138 | elseif Selected and (CurrentMenu.Controls.Right.Active or (CurrentMenu.Controls.Click.Active and RightArrowHovered)) and not (CurrentMenu.Controls.Left.Active or (CurrentMenu.Controls.Click.Active and LeftArrowHovered)) then 139 | Index = Index + 1 140 | if Index > #Items then 141 | Index = 1 142 | end 143 | if (onListChange ~= nil) then 144 | onListChange(Index, Items[Index]); 145 | end 146 | local Audio = RageUI.Settings.Audio 147 | RageUI.PlaySound(Audio[Audio.Use].LeftRight.audioName, Audio[Audio.Use].LeftRight.audioRef) 148 | end 149 | 150 | if Selected and (CurrentMenu.Controls.Select.Active or ((Hovered and CurrentMenu.Controls.Click.Active) and (not LeftArrowHovered and not RightArrowHovered))) then 151 | local Audio = RageUI.Settings.Audio 152 | RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef) 153 | 154 | if Submenu ~= nil and type(Submenu) == "table" then 155 | RageUI.NextMenu = Submenu[Index] 156 | end 157 | end 158 | 159 | if (Enabled) then 160 | Callback(Hovered, Selected, ((CurrentMenu.Controls.Select.Active or ((Hovered and CurrentMenu.Controls.Click.Active) and (not LeftArrowHovered and not RightArrowHovered))) and Selected), Index) 161 | end 162 | end 163 | 164 | RageUI.Options = RageUI.Options + 1 165 | end 166 | end 167 | end 168 | -------------------------------------------------------------------------------- /vendors/RageUI/menu/items/UICheckBox.lua: -------------------------------------------------------------------------------- 1 | ---@type table 2 | local SettingsButton = { 3 | Rectangle = { Y = 0, Width = 431, Height = 38 }, 4 | Text = { X = 8, Y = 3, Scale = 0.33 }, 5 | LeftBadge = { Y = -2, Width = 40, Height = 40 }, 6 | RightBadge = { X = 385, Y = -2, Width = 40, Height = 40 }, 7 | RightText = { X = 420, Y = 4, Scale = 0.35 }, 8 | SelectedSprite = { Dictionary = "commonmenu", Texture = "gradient_nav", Y = 0, Width = 431, Height = 38 }, 9 | } 10 | 11 | ---@type table 12 | local SettingsCheckbox = { 13 | Dictionary = "commonmenu", Textures = { 14 | "shop_box_blankb", -- 1 15 | "shop_box_tickb", -- 2 16 | "shop_box_blank", -- 3 17 | "shop_box_tick", -- 4 18 | "shop_box_crossb", -- 5 19 | "shop_box_cross", -- 6 20 | }, 21 | X = 380, Y = -6, Width = 50, Height = 50 22 | } 23 | 24 | RageUI.CheckboxStyle = { 25 | Tick = 1, 26 | Cross = 2 27 | } 28 | 29 | ---StyleCheckBox 30 | ---@param Selected number 31 | ---@param Checked boolean 32 | ---@param Box number 33 | ---@param BoxSelect number 34 | ---@return nil 35 | local function StyleCheckBox(Selected, Checked, Box, BoxSelect, OffSet) 36 | 37 | ---@type table 38 | local CurrentMenu = RageUI.CurrentMenu; 39 | if OffSet == nil then 40 | OffSet = 0 41 | end 42 | if Selected then 43 | if Checked then 44 | RenderSprite(SettingsCheckbox.Dictionary, SettingsCheckbox.Textures[Box], CurrentMenu.X + SettingsCheckbox.X + CurrentMenu.WidthOffset - OffSet, CurrentMenu.Y + SettingsCheckbox.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsCheckbox.Width, SettingsCheckbox.Height) 45 | else 46 | RenderSprite(SettingsCheckbox.Dictionary, SettingsCheckbox.Textures[1], CurrentMenu.X + SettingsCheckbox.X + CurrentMenu.WidthOffset - OffSet, CurrentMenu.Y + SettingsCheckbox.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsCheckbox.Width, SettingsCheckbox.Height) 47 | end 48 | else 49 | if Checked then 50 | RenderSprite(SettingsCheckbox.Dictionary, SettingsCheckbox.Textures[BoxSelect], CurrentMenu.X + SettingsCheckbox.X + CurrentMenu.WidthOffset - OffSet, CurrentMenu.Y + SettingsCheckbox.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsCheckbox.Width, SettingsCheckbox.Height) 51 | else 52 | RenderSprite(SettingsCheckbox.Dictionary, SettingsCheckbox.Textures[3], CurrentMenu.X + SettingsCheckbox.X + CurrentMenu.WidthOffset - OffSet, CurrentMenu.Y + SettingsCheckbox.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsCheckbox.Width, SettingsCheckbox.Height) 53 | end 54 | end 55 | end 56 | 57 | ---CheckBoxLockBadgeColor 58 | ---@param Selected boolean 59 | ---@return table 60 | local function CheckBoxLockBadgeColor(Selected) 61 | if Selected then 62 | return 0, 0, 0, 255 63 | else 64 | return 163, 159, 148, 255 65 | end 66 | end 67 | 68 | ---Checkbox 69 | ---@param Label string 70 | ---@param Description string 71 | ---@param Checked boolean 72 | ---@param Callback function 73 | ---@return nil 74 | ---@public 75 | function RageUI.Checkbox(Label, Description, Checked, Style, Callback, onChecked, onUnchecked) 76 | 77 | ---@type table 78 | local CurrentMenu = RageUI.CurrentMenu; 79 | 80 | if CurrentMenu ~= nil then 81 | if CurrentMenu() then 82 | 83 | ---@type number 84 | local Option = RageUI.Options + 1 85 | 86 | if CurrentMenu.Pagination.Minimum <= Option and CurrentMenu.Pagination.Maximum >= Option then 87 | 88 | ---@type number 89 | local Selected = CurrentMenu.Index == Option 90 | local LeftBadgeOffset = ((Style.LeftBadge == RageUI.BadgeStyle.None or Style.LeftBadge == nil) and 0 or 27) 91 | local RightBadgeOffset = ((Style.RightBadge == RageUI.BadgeStyle.None or Style.RightBadge == nil) and 0 or 32) 92 | local BoxOffset = 0 93 | RageUI.ItemsSafeZone(CurrentMenu) 94 | 95 | local Hovered = false; 96 | 97 | ---@type boolean 98 | if CurrentMenu.EnableMouse == true and (CurrentMenu.CursorStyle == 0) or (CurrentMenu.CursorStyle == 1) then 99 | Hovered = RageUI.ItemsMouseBounds(CurrentMenu, Selected, Option, SettingsButton); 100 | end 101 | if Selected then 102 | RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height) 103 | end 104 | 105 | if type(Style) == "table" then 106 | if Style.Enabled == true or Style.Enabled == nil then 107 | if Selected then 108 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 0, 0, 0, 255) 109 | else 110 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 245, 245, 245, 255) 111 | end 112 | 113 | if type(Style) == 'table' then 114 | if Style.LeftBadge ~= nil then 115 | if Style.LeftBadge ~= RageUI.BadgeStyle.None then 116 | local BadgeData = Style.LeftBadge(Selected) 117 | 118 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, 0, BadgeData.BadgeColour and BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.A or 255) 119 | end 120 | end 121 | 122 | if Style.RightBadge ~= nil then 123 | if Style.RightBadge ~= RageUI.BadgeStyle.None then 124 | local BadgeData = Style.RightBadge(Selected) 125 | 126 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X + SettingsButton.RightBadge.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.RightBadge.Width, SettingsButton.RightBadge.Height, 0, BadgeData.BadgeColour and BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.A or 255) 127 | end 128 | end 129 | end 130 | else 131 | ---@type table 132 | local LeftBadge = RageUI.BadgeStyle.Lock 133 | 134 | ---@type number 135 | 136 | local LeftBadgeOffset = ((LeftBadge == RageUI.BadgeStyle.None or LeftBadge == nil) and 0 or 27) 137 | 138 | if Selected then 139 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 0, 0, 0, 255) 140 | else 141 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 163, 159, 148, 255) 142 | end 143 | 144 | if LeftBadge ~= RageUI.BadgeStyle.None and LeftBadge ~= nil then 145 | local BadgeData = LeftBadge(Selected) 146 | 147 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, 0, BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour.A or 255) 148 | end 149 | end 150 | 151 | if Enabled == true or Enabled == nil then 152 | if Selected then 153 | if Style.RightLabel ~= nil and Style.RightLabel ~= "" then 154 | 155 | RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 0, 0, 0, 255, 2) 156 | BoxOffset = MeasureStringWidth(Style.RightLabel, 0, 0.35) 157 | end 158 | else 159 | if Style.RightLabel ~= nil and Style.RightLabel ~= "" then 160 | RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 245, 245, 245, 255, 2) 161 | BoxOffset = MeasureStringWidth(Style.RightLabel, 0, 0.35) 162 | end 163 | end 164 | 165 | end 166 | 167 | BoxOffset = RightBadgeOffset + BoxOffset 168 | if Style.Style ~= nil then 169 | if Style.Style == RageUI.CheckboxStyle.Tick then 170 | StyleCheckBox(Selected, Checked, 2, 4, BoxOffset) 171 | elseif Style.Style == RageUI.CheckboxStyle.Cross then 172 | StyleCheckBox(Selected, Checked, 5, 6, BoxOffset) 173 | else 174 | StyleCheckBox(Selected, Checked, 2, 4, BoxOffset) 175 | end 176 | else 177 | StyleCheckBox(Selected, Checked, 2, 4, BoxOffset) 178 | end 179 | 180 | if Selected and (CurrentMenu.Controls.Select.Active or (Hovered and CurrentMenu.Controls.Click.Active)) and (Style.Enabled == true or Style.Enabled == nil) then 181 | local Audio = RageUI.Settings.Audio 182 | RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef) 183 | Checked = not Checked 184 | if (Checked) then 185 | onChecked(); 186 | else 187 | onUnchecked() 188 | end 189 | end 190 | 191 | if Selected and (CurrentMenu.Controls.Select.Active or (Hovered and CurrentMenu.Controls.Click.Active)) and (Style.Enabled == false) then 192 | local Audio = RageUI.Settings.Audio 193 | RageUI.PlaySound(Audio[Audio.Use].Error.audioName, Audio[Audio.Use].Error.audioRef) 194 | Checked = false 195 | if (Checked) then 196 | onChecked(); 197 | else 198 | onUnchecked() 199 | end 200 | end 201 | 202 | else 203 | error("UICheckBox Style is not a `table`") 204 | end 205 | 206 | RageUI.ItemOffset = RageUI.ItemOffset + SettingsButton.Rectangle.Height 207 | 208 | RageUI.ItemsDescription(CurrentMenu, Description, Selected) 209 | 210 | Callback(Hovered, Selected, ((CurrentMenu.Controls.Select.Active or (Hovered and CurrentMenu.Controls.Click.Active)) and Selected), Checked) 211 | end 212 | RageUI.Options = RageUI.Options + 1 213 | end 214 | end 215 | end 216 | 217 | 218 | -------------------------------------------------------------------------------- /vendors/RageUI/menu/items/UISlider.lua: -------------------------------------------------------------------------------- 1 | ---@type table 2 | local SettingsButton = { 3 | Rectangle = { Y = 0, Width = 431, Height = 38 }, 4 | Text = { X = 8, Y = 3, Scale = 0.33 }, 5 | LeftBadge = { Y = -2, Width = 40, Height = 40 }, 6 | RightBadge = { X = 385, Y = -2, Width = 40, Height = 40 }, 7 | RightText = { X = 420, Y = 4, Scale = 0.35 }, 8 | SelectedSprite = { Dictionary = "commonmenu", Texture = "gradient_nav", Y = 0, Width = 431, Height = 38 }, 9 | } 10 | 11 | ---@type table 12 | local SettingsSlider = { 13 | Background = { X = 250, Y = 14.5, Width = 150, Height = 9 }, 14 | Slider = { X = 250, Y = 14.5, Width = 75, Height = 9 }, 15 | Divider = { X = 323.5, Y = 9, Width = 2.5, Height = 20 }, 16 | LeftArrow = { Dictionary = "commonmenutu", Texture = "arrowleft", X = 235, Y = 11.5, Width = 15, Height = 15 }, 17 | RightArrow = { Dictionary = "commonmenutu", Texture = "arrowright", X = 400, Y = 11.5, Width = 15, Height = 15 }, 18 | } 19 | 20 | 21 | ---Slider 22 | ---@param Label string 23 | ---@param ProgressStart number 24 | ---@param ProgressMax number 25 | ---@param Description string 26 | ---@param Divider boolean 27 | ---@param Enabled boolean 28 | ---@param Callback function 29 | function RageUI.Slider(Label, ProgressStart, ProgressMax, Description, Divider, Style, Enabled, Callback) 30 | 31 | ---@type table 32 | local CurrentMenu = RageUI.CurrentMenu; 33 | local Audio = RageUI.Settings.Audio 34 | 35 | if CurrentMenu ~= nil then 36 | if CurrentMenu() then 37 | 38 | local Items = {} 39 | for i = 1, ProgressMax do 40 | table.insert(Items, i) 41 | end 42 | ---@type number 43 | local Option = RageUI.Options + 1 44 | 45 | if CurrentMenu.Pagination.Minimum <= Option and CurrentMenu.Pagination.Maximum >= Option then 46 | 47 | ---@type number 48 | local Selected = CurrentMenu.Index == Option 49 | 50 | ---@type boolean 51 | local LeftArrowHovered, RightArrowHovered = false, false 52 | 53 | RageUI.ItemsSafeZone(CurrentMenu) 54 | 55 | local Hovered = false; 56 | local LeftBadgeOffset = ((Style.LeftBadge == RageUI.BadgeStyle.None or Style.LeftBadge == nil) and 0 or 27) 57 | local RightBadgeOffset = ((Style.RightBadge == RageUI.BadgeStyle.None or Style.RightBadge == nil) and 0 or 32) 58 | local RightOffset = 0 59 | ---@type boolean 60 | if CurrentMenu.EnableMouse == true and (CurrentMenu.CursorStyle == 0) or (CurrentMenu.CursorStyle == 1) then 61 | Hovered = RageUI.ItemsMouseBounds(CurrentMenu, Selected, Option, SettingsButton); 62 | end 63 | 64 | if Selected then 65 | RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height) 66 | LeftArrowHovered = RageUI.IsMouseInBounds(CurrentMenu.X + SettingsSlider.LeftArrow.X + CurrentMenu.SafeZoneSize.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsSlider.LeftArrow.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.LeftArrow.Width, SettingsSlider.LeftArrow.Height) 67 | RightArrowHovered = RageUI.IsMouseInBounds(CurrentMenu.X + SettingsSlider.RightArrow.X + CurrentMenu.SafeZoneSize.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsSlider.RightArrow.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.RightArrow.Width, SettingsSlider.RightArrow.Height) 68 | end 69 | if Enabled == true or Enabled == nil then 70 | if Selected then 71 | if Style.RightLabel ~= nil and Style.RightLabel ~= "" then 72 | RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 0, 0, 0, 255, 2) 73 | RightOffset = MeasureStringWidth(Style.RightLabel, 0, 0.35) 74 | end 75 | else 76 | if Style.RightLabel ~= nil and Style.RightLabel ~= "" then 77 | RightOffset = MeasureStringWidth(Style.RightLabel, 0, 0.35) 78 | RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 245, 245, 245, 255, 2) 79 | end 80 | end 81 | end 82 | RightOffset = RightOffset + RightBadgeOffset 83 | if Enabled == true or Enabled == nil then 84 | if Selected then 85 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 0, 0, 0, 255) 86 | 87 | RenderSprite(SettingsSlider.LeftArrow.Dictionary, SettingsSlider.LeftArrow.Texture, CurrentMenu.X + SettingsSlider.LeftArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.LeftArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.LeftArrow.Width, SettingsSlider.LeftArrow.Height, 0, 0, 0, 0, 255) 88 | RenderSprite(SettingsSlider.RightArrow.Dictionary, SettingsSlider.RightArrow.Texture, CurrentMenu.X + SettingsSlider.RightArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.RightArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.RightArrow.Width, SettingsSlider.RightArrow.Height, 0, 0, 0, 0, 255) 89 | else 90 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 245, 245, 245, 255) 91 | end 92 | else 93 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 163, 159, 148, 255) 94 | 95 | if Selected then 96 | RenderSprite(SettingsSlider.LeftArrow.Dictionary, SettingsSlider.LeftArrow.Texture, CurrentMenu.X + SettingsSlider.LeftArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.LeftArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.LeftArrow.Width, SettingsSlider.LeftArrow.Height, 163, 159, 148, 255) 97 | RenderSprite(SettingsSlider.RightArrow.Dictionary, SettingsSlider.RightArrow.Texture, CurrentMenu.X + SettingsSlider.RightArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.RightArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.RightArrow.Width, SettingsSlider.RightArrow.Height, 163, 159, 148, 255) 98 | end 99 | end 100 | 101 | if type(Style) == "table" then 102 | if Style.Enabled == true or Style.Enabled == nil then 103 | if type(Style) == 'table' then 104 | if Style.LeftBadge ~= nil then 105 | if Style.LeftBadge ~= RageUI.BadgeStyle.None then 106 | local BadgeData = Style.LeftBadge(Selected) 107 | 108 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, 0, BadgeData.BadgeColour and BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.A or 255) 109 | end 110 | end 111 | 112 | if Style.RightBadge ~= nil then 113 | if Style.RightBadge ~= RageUI.BadgeStyle.None then 114 | local BadgeData = Style.RightBadge(Selected) 115 | 116 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X + SettingsButton.RightBadge.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.RightBadge.Width, SettingsButton.RightBadge.Height, 0, BadgeData.BadgeColour and BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.A or 255) 117 | end 118 | end 119 | end 120 | else 121 | ---@type table 122 | local LeftBadge = RageUI.BadgeStyle.Lock 123 | 124 | if LeftBadge ~= RageUI.BadgeStyle.None and LeftBadge ~= nil then 125 | local BadgeData = LeftBadge(Selected) 126 | 127 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, 0, BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour.A or 255) 128 | end 129 | end 130 | else 131 | error("UICheckBox Style is not a `table`") 132 | end 133 | 134 | RenderRectangle(CurrentMenu.X + SettingsSlider.Background.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.Background.Width, SettingsSlider.Background.Height, 4, 32, 57, 255) 135 | RenderRectangle(CurrentMenu.X + SettingsSlider.Slider.X + (((SettingsSlider.Background.Width - SettingsSlider.Slider.Width) / (#Items - 1)) * (ProgressStart - 1)) + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.Slider.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.Slider.Width, SettingsSlider.Slider.Height, 57, 116, 200, 255) 136 | 137 | if Divider then 138 | RenderRectangle(CurrentMenu.X + SettingsSlider.Divider.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsSlider.Divider.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.Divider.Width, SettingsSlider.Divider.Height, 245, 245, 245, 255) 139 | end 140 | 141 | RageUI.ItemOffset = RageUI.ItemOffset + SettingsButton.Rectangle.Height 142 | 143 | RageUI.ItemsDescription(CurrentMenu, Description, Selected); 144 | 145 | if Selected and (CurrentMenu.Controls.Left.Active or (CurrentMenu.Controls.Click.Active and LeftArrowHovered)) and not (CurrentMenu.Controls.Right.Active or (CurrentMenu.Controls.Click.Active and RightArrowHovered)) then 146 | ProgressStart = ProgressStart - 1 147 | 148 | if ProgressStart < 1 then 149 | ProgressStart = #Items 150 | end 151 | 152 | RageUI.PlaySound(Audio[Audio.Use].LeftRight.audioName, Audio[Audio.Use].LeftRight.audioRef) 153 | elseif Selected and (CurrentMenu.Controls.Right.Active or (CurrentMenu.Controls.Click.Active and RightArrowHovered)) and not (CurrentMenu.Controls.Left.Active or (CurrentMenu.Controls.Click.Active and LeftArrowHovered)) then 154 | ProgressStart = ProgressStart + 1 155 | if ProgressStart > #Items then 156 | ProgressStart = 1 157 | end 158 | 159 | RageUI.PlaySound(Audio[Audio.Use].LeftRight.audioName, Audio[Audio.Use].LeftRight.audioRef) 160 | end 161 | 162 | if Selected and (CurrentMenu.Controls.Select.Active or ((Hovered and CurrentMenu.Controls.Click.Active) and (not LeftArrowHovered and not RightArrowHovered))) then 163 | RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef) 164 | end 165 | 166 | if (Enabled) then 167 | Callback(Hovered, Selected, ((CurrentMenu.Controls.Select.Active or ((Hovered and CurrentMenu.Controls.Click.Active) and (not LeftArrowHovered and not RightArrowHovered))) and Selected), ProgressStart) 168 | end 169 | end 170 | 171 | RageUI.Options = RageUI.Options + 1 172 | end 173 | end 174 | end 175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /vendors/RageUI/menu/Menu.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- Generated by EmmyLua(https://github.com/EmmyLua) 3 | --- Created by Dylan Malandain. 4 | --- DateTime: 21/04/2019 21:20 5 | --- 6 | 7 | ---CreateMenu 8 | ---@param Title string 9 | ---@param Subtitle string 10 | ---@param X number 11 | ---@param Y number 12 | ---@param TextureDictionary string 13 | ---@param TextureName string 14 | ---@param R number 15 | ---@param G number 16 | ---@param B number 17 | ---@param A number 18 | ---@return table 19 | ---@public 20 | function RageUI.CreateMenu(Title, Subtitle, X, Y, TextureDictionary, TextureName, R, G, B, A) 21 | 22 | ---@type table 23 | local Menu = {} 24 | Menu.InstructionalButtons = {} 25 | Menu.Title = Title or "" 26 | Menu.Subtitle = Subtitle or "" 27 | Menu.SubtitleHeight = -37 28 | Menu.Description = nil 29 | Menu.DescriptionHeight = RageUI.Settings.Items.Description.Background.Height 30 | Menu.X = X or 0 31 | Menu.Y = Y or 0 32 | Menu.Parent = nil 33 | Menu.WidthOffset = RageUI.UI.Style[RageUI.UI.Current].Width 34 | Menu.Open = false 35 | Menu.Controls = RageUI.Settings.Controls 36 | Menu.Index = 1 37 | Menu.Sprite = { Dictionary = TextureDictionary or "commonmenu", Texture = TextureName or "interaction_bgd", Color = { R = R, G = G, B = B, A = A } } 38 | Menu.Rectangle = nil 39 | Menu.Pagination = { Minimum = 1, Maximum = 10, Total = 10 } 40 | Menu.Safezone = true 41 | Menu.SafeZoneSize = nil 42 | Menu.EnableMouse = false 43 | Menu.Options = 0 44 | Menu.Closable = true 45 | Menu.InstructionalScaleform = RequestScaleformMovie("INSTRUCTIONAL_BUTTONS") 46 | Menu.CursorStyle = 1 47 | 48 | if string.starts(Menu.Subtitle, "~") then 49 | Menu.PageCounterColour = string.sub(Menu.Subtitle, 1, 3) 50 | else 51 | Menu.PageCounterColour = "" 52 | end 53 | 54 | if Menu.Subtitle ~= "" then 55 | local SubtitleLineCount = GetLineCount(Menu.Subtitle, Menu.X + RageUI.Settings.Items.Subtitle.Text.X, Menu.Y + RageUI.Settings.Items.Subtitle.Text.Y, 0, RageUI.Settings.Items.Subtitle.Text.Scale, 245, 245, 245, 255, nil, false, false, RageUI.Settings.Items.Subtitle.Background.Width + Menu.WidthOffset) 56 | 57 | if SubtitleLineCount > 1 then 58 | Menu.SubtitleHeight = 18 * SubtitleLineCount 59 | else 60 | Menu.SubtitleHeight = 0 61 | end 62 | end 63 | 64 | Citizen.CreateThread(function() 65 | if not HasScaleformMovieLoaded(Menu.InstructionalScaleform) then 66 | Menu.InstructionalScaleform = RequestScaleformMovie("INSTRUCTIONAL_BUTTONS") 67 | while not HasScaleformMovieLoaded(Menu.InstructionalScaleform) do 68 | Citizen.Wait(0) 69 | end 70 | end 71 | end) 72 | 73 | return setmetatable(Menu, RageUI.Menus) 74 | end 75 | 76 | ---CreateSubMenu 77 | ---@param ParentMenu function 78 | ---@param Title string 79 | ---@param Subtitle string 80 | ---@param X number 81 | ---@param Y number 82 | ---@param TextureDictionary string 83 | ---@param TextureName string 84 | ---@param R number 85 | ---@param G number 86 | ---@param B number 87 | ---@param A number 88 | ---@return table 89 | ---@public 90 | function RageUI.CreateSubMenu(ParentMenu, Title, Subtitle, X, Y, TextureDictionary, TextureName, R, G, B, A) 91 | if ParentMenu ~= nil then 92 | if ParentMenu() then 93 | 94 | ---@type table 95 | local Menu = {} 96 | Menu.InstructionalButtons = {} 97 | Menu.Title = Title or ParentMenu.Title 98 | Menu.Subtitle = Subtitle or ParentMenu.Subtitle 99 | Menu.SubtitleHeight = -37 100 | Menu.Description = nil 101 | Menu.DescriptionHeight = RageUI.Settings.Items.Description.Background.Height 102 | Menu.X = X or ParentMenu.X 103 | Menu.Y = Y or ParentMenu.Y 104 | Menu.Parent = ParentMenu 105 | Menu.WidthOffset = ParentMenu.WidthOffset 106 | Menu.Open = false 107 | Menu.Controls = RageUI.Settings.Controls 108 | Menu.Index = 1 109 | Menu.Pagination = { Minimum = 1, Maximum = 10, Total = 10 } 110 | Menu.Safezone = ParentMenu.Safezone 111 | Menu.SafeZoneSize = nil 112 | Menu.EnableMouse = false 113 | Menu.Options = 0 114 | Menu.Closable = true 115 | Menu.InstructionalScaleform = RequestScaleformMovie("INSTRUCTIONAL_BUTTONS") 116 | Menu.CursorStyle = 1 117 | 118 | if string.starts(Menu.Subtitle, "~") then 119 | Menu.PageCounterColour = string.sub(Menu.Subtitle, 1, 3) 120 | else 121 | Menu.PageCounterColour = "" 122 | end 123 | 124 | if Menu.Subtitle ~= "" then 125 | local SubtitleLineCount = GetLineCount(Menu.Subtitle, Menu.X + RageUI.Settings.Items.Subtitle.Text.X, Menu.Y + RageUI.Settings.Items.Subtitle.Text.Y, 0, RageUI.Settings.Items.Subtitle.Text.Scale, 245, 245, 245, 255, nil, false, false, RageUI.Settings.Items.Subtitle.Background.Width + Menu.WidthOffset) 126 | 127 | if SubtitleLineCount > 1 then 128 | Menu.SubtitleHeight = 18 * SubtitleLineCount 129 | else 130 | Menu.SubtitleHeight = 0 131 | end 132 | end 133 | 134 | if ParentMenu.Sprite then 135 | Menu.Sprite = { Dictionary = TextureDictionary or ParentMenu.Sprite.Dictionary, Texture = TextureName or ParentMenu.Sprite.Texture, Color = { R = R or ParentMenu.Sprite.Color.R, G = G or ParentMenu.Sprite.Color.G, B = B or ParentMenu.Sprite.Color.B, A = A or ParentMenu.Sprite.Color.A } } 136 | else 137 | Menu.Rectangle = ParentMenu.Rectangle 138 | end 139 | 140 | return setmetatable(Menu, RageUI.Menus) 141 | else 142 | return nil 143 | end 144 | else 145 | return nil 146 | end 147 | end 148 | 149 | ---SetTitle 150 | ---@param Title string 151 | ---@return nil 152 | ---@public 153 | function RageUI.Menus:SetTitle(Title) 154 | self.Title = Title 155 | end 156 | 157 | ---SetStyleSize 158 | ---@param Value int 159 | ---@return nil 160 | ---@public 161 | function RageUI.Menus:SetStyleSize(Value) 162 | local witdh 163 | if Value >= 0 and Value <= 100 then 164 | witdh = Value 165 | else 166 | witdh = 100 167 | end 168 | self.WidthOffset = witdh 169 | end 170 | 171 | 172 | ---GetStyleSize 173 | ---@return any 174 | ---@public 175 | function RageUI.Menus:GetStyleSize() 176 | if(self.WidthOffset == 100)then 177 | return "RageUI" 178 | elseif(self.WidthOffset == 0)then 179 | return "NativeUI"; 180 | else 181 | return self.WidthOffset; 182 | end 183 | end 184 | 185 | ---SetStyleSize 186 | ---@param Int string 187 | ---@return void 188 | ---@public 189 | function RageUI.Menus:SetCursorStyle(Int) 190 | self.CursorStyle = Int or 1 or 0 191 | SetMouseCursorSprite(Int) 192 | end 193 | 194 | ---ResetCursorStyle 195 | ---@return void 196 | ---@public 197 | function RageUI.Menus:ResetCursorStyle() 198 | self.CursorStyle = 1 199 | SetMouseCursorSprite(1) 200 | end 201 | 202 | ---UpdateCursorStyle 203 | ---@return void 204 | ---@public 205 | function RageUI.Menus:UpdateCursorStyle() 206 | SetMouseCursorSprite(self.CursorStyle) 207 | end 208 | 209 | ---RefreshIndex 210 | ---@return void 211 | ---@public 212 | function RageUI.Menus:RefreshIndex() 213 | self.Index = 1 214 | end 215 | 216 | ---SetSubtitle 217 | ---@param Subtitle string 218 | ---@return nil 219 | ---@public 220 | function RageUI.Menus:SetSubtitle(Subtitle) 221 | 222 | self.Subtitle = Subtitle or self.Subtitle 223 | 224 | if string.starts(self.Subtitle, "~") then 225 | self.PageCounterColour = string.sub(self.Subtitle, 1, 3) 226 | else 227 | self.PageCounterColour = "" 228 | end 229 | 230 | if self.Subtitle ~= "" then 231 | local SubtitleLineCount = GetLineCount(self.Subtitle, self.X + RageUI.Settings.Items.Subtitle.Text.X, self.Y + RageUI.Settings.Items.Subtitle.Text.Y, 0, RageUI.Settings.Items.Subtitle.Text.Scale, 245, 245, 245, 255, nil, false, false, RageUI.Settings.Items.Subtitle.Background.Width + self.WidthOffset) 232 | 233 | if SubtitleLineCount > 1 then 234 | self.SubtitleHeight = 18 * SubtitleLineCount 235 | else 236 | self.SubtitleHeight = 0 237 | end 238 | 239 | else 240 | self.SubtitleHeight = -37 241 | end 242 | end 243 | 244 | ---PageCounter 245 | ---@param Subtitle string 246 | ---@return nil 247 | ---@public 248 | function RageUI.Menus:SetPageCounter(Subtitle) 249 | self.PageCounter = Subtitle 250 | end 251 | 252 | ---EditSpriteColor 253 | ---@param Colors table 254 | ---@return nil 255 | ---@public 256 | function RageUI.Menus:EditSpriteColor(color) 257 | if self.Sprite.Dictionary == "commonmenu" then 258 | self.Sprite.Color = color 259 | end 260 | end 261 | ---SetPosition 262 | ---@param X number 263 | ---@param Y number 264 | ---@return nil 265 | ---@public 266 | function RageUI.Menus:SetPosition(X, Y) 267 | self.X = tonumber(X) or self.X 268 | self.Y = tonumber(Y) or self.Y 269 | end 270 | 271 | ---SetTotalItemsPerPage 272 | ---@param Value number 273 | ---@return nil 274 | ---@public 275 | function RageUI.Menus:SetTotalItemsPerPage(Value) 276 | self.Pagination.Total = tonumber(Value) or self.Pagination.Total 277 | end 278 | 279 | ---SetRectangleBanner 280 | ---@param R number 281 | ---@param G number 282 | ---@param B number 283 | ---@param A number 284 | ---@return nil 285 | ---@public 286 | function RageUI.Menus:SetRectangleBanner(R, G, B, A) 287 | self.Rectangle = { R = tonumber(R) or 255, G = tonumber(G) or 255, B = tonumber(B) or 255, A = tonumber(A) or 255 } 288 | self.Sprite = nil 289 | end 290 | 291 | ---SetSpriteBanner 292 | ---@param TextureDictionary string 293 | ---@param Texture string 294 | ---@return nil 295 | ---@public 296 | function RageUI.Menus:SetSpriteBanner(TextureDictionary, Texture) 297 | self.Sprite = { Dictionary = TextureDictionary or "commonmenu", Texture = Texture or "interaction_bgd" } 298 | self.Rectangle = nil 299 | end 300 | 301 | function RageUI.Menus:Closable(boolean) 302 | if type(boolean) == "boolean" then 303 | self.Closable = boolean 304 | else 305 | error("Type is not boolean") 306 | end 307 | end 308 | 309 | function RageUI.Menus:AddInstructionButton(button) 310 | if type(button) == "table" and #button == 2 then 311 | table.insert(self.InstructionalButtons, button) 312 | self.UpdateInstructionalButtons(true); 313 | end 314 | end 315 | 316 | function RageUI.Menus:RemoveInstructionButton(button) 317 | if type(button) == "table" then 318 | for i = 1, #self.InstructionalButtons do 319 | if button == self.InstructionalButtons[i] then 320 | table.remove(self.InstructionalButtons, i) 321 | self.UpdateInstructionalButtons(true); 322 | break 323 | end 324 | end 325 | else 326 | if tonumber(button) then 327 | if self.InstructionalButtons[tonumber(button)] then 328 | table.remove(self.InstructionalButtons, tonumber(button)) 329 | self.UpdateInstructionalButtons(true); 330 | end 331 | end 332 | end 333 | end 334 | 335 | function RageUI.Menus:UpdateInstructionalButtons(Visible) 336 | 337 | if not Visible then 338 | return 339 | end 340 | 341 | BeginScaleformMovieMethod(self.InstructionalScaleform, "CLEAR_ALL") 342 | EndScaleformMovieMethod() 343 | 344 | BeginScaleformMovieMethod(self.InstructionalScaleform, "TOGGLE_MOUSE_BUTTONS") 345 | ScaleformMovieMethodAddParamInt(0) 346 | EndScaleformMovieMethod() 347 | 348 | BeginScaleformMovieMethod(self.InstructionalScaleform, "CREATE_CONTAINER") 349 | EndScaleformMovieMethod() 350 | 351 | BeginScaleformMovieMethod(self.InstructionalScaleform, "SET_DATA_SLOT") 352 | ScaleformMovieMethodAddParamInt(0) 353 | PushScaleformMovieMethodParameterButtonName(GetControlInstructionalButton(2, 176, 0)) 354 | PushScaleformMovieMethodParameterString(GetLabelText("HUD_INPUT2")) 355 | EndScaleformMovieMethod() 356 | 357 | if self.Closable then 358 | BeginScaleformMovieMethod(self.InstructionalScaleform, "SET_DATA_SLOT") 359 | ScaleformMovieMethodAddParamInt(1) 360 | PushScaleformMovieMethodParameterButtonName(GetControlInstructionalButton(2, 177, 0)) 361 | PushScaleformMovieMethodParameterString(GetLabelText("HUD_INPUT3")) 362 | EndScaleformMovieMethod() 363 | end 364 | 365 | local count = 2 366 | 367 | if (self.InstructionalButtons ~= nil) then 368 | for i = 1, #self.InstructionalButtons do 369 | if self.InstructionalButtons[i] then 370 | if #self.InstructionalButtons[i] == 2 then 371 | BeginScaleformMovieMethod(self.InstructionalScaleform, "SET_DATA_SLOT") 372 | ScaleformMovieMethodAddParamInt(count) 373 | PushScaleformMovieMethodParameterButtonName(self.InstructionalButtons[i][1]) 374 | PushScaleformMovieMethodParameterString(self.InstructionalButtons[i][2]) 375 | EndScaleformMovieMethod() 376 | count = count + 1 377 | end 378 | end 379 | end 380 | end 381 | 382 | BeginScaleformMovieMethod(self.InstructionalScaleform, "DRAW_INSTRUCTIONAL_BUTTONS") 383 | ScaleformMovieMethodAddParamInt(-1) 384 | EndScaleformMovieMethod() 385 | end 386 | -------------------------------------------------------------------------------- /vendors/RageUI/menu/items/UISliderProgress.lua: -------------------------------------------------------------------------------- 1 | --- 2 | --- Generated by EmmyLua(https://github.com/EmmyLua) 3 | --- Created by Dylan Malandain. 4 | --- DateTime: 21/11/2019 01:33 5 | --- 6 | 7 | ---@type table 8 | local SettingsButton = { 9 | Rectangle = { Y = 0, Width = 431, Height = 38 }, 10 | Text = { X = 8, Y = 3, Scale = 0.33 }, 11 | LeftBadge = { Y = -2, Width = 40, Height = 40 }, 12 | RightBadge = { X = 385, Y = -2, Width = 40, Height = 40 }, 13 | RightText = { X = 420, Y = 4, Scale = 0.35 }, 14 | SelectedSprite = { Dictionary = "commonmenu", Texture = "gradient_nav", Y = 0, Width = 431, Height = 38 }, 15 | } 16 | 17 | ---@type table 18 | local SettingsSlider = { 19 | Background = { X = 250, Y = 14.5, Width = 150, Height = 9 }, 20 | Slider = { X = 250, Y = 14.5, Width = 150, Height = 9 }, 21 | LeftArrow = { Dictionary = "commonmenutu", Texture = "arrowleft", X = 235, Y = 11.5, Width = 15, Height = 15 }, 22 | RightArrow = { Dictionary = "commonmenutu", Texture = "arrowright", X = 400, Y = 11.5, Width = 15, Height = 15 }, 23 | } 24 | 25 | ---Slider 26 | ---@param Label string 27 | ---@param ProgressStart number 28 | ---@param ProgressMax number 29 | ---@param Description string 30 | ---@param Enabled boolean 31 | ---@param Callback function 32 | function RageUI.SliderProgress(Label, ProgressStart, ProgressMax, Description, Style, Enabled, Callback) 33 | 34 | ---@type table 35 | local CurrentMenu = RageUI.CurrentMenu; 36 | local Audio = RageUI.Settings.Audio 37 | 38 | if CurrentMenu ~= nil then 39 | if CurrentMenu() then 40 | 41 | local Items = {} 42 | for i = 1, ProgressMax do 43 | table.insert(Items, i) 44 | end 45 | ---@type number 46 | local Option = RageUI.Options + 1 47 | 48 | if CurrentMenu.Pagination.Minimum <= Option and CurrentMenu.Pagination.Maximum >= Option then 49 | 50 | ---@type number 51 | local Selected = CurrentMenu.Index == Option 52 | 53 | ---@type boolean 54 | local LeftArrowHovered, RightArrowHovered = false, false 55 | 56 | RageUI.ItemsSafeZone(CurrentMenu) 57 | 58 | local Hovered = false; 59 | local LeftBadgeOffset = ((Style.LeftBadge == RageUI.BadgeStyle.None or Style.LeftBadge == nil) and 0 or 27) 60 | local RightBadgeOffset = ((Style.RightBadge == RageUI.BadgeStyle.None or Style.RightBadge == nil) and 0 or 32) 61 | local RightOffset = 0 62 | ---@type boolean 63 | if CurrentMenu.EnableMouse == true and (CurrentMenu.CursorStyle == 0) or (CurrentMenu.CursorStyle == 1) then 64 | Hovered = RageUI.ItemsMouseBounds(CurrentMenu, Selected, Option, SettingsButton); 65 | end 66 | 67 | if Selected then 68 | RenderSprite(SettingsButton.SelectedSprite.Dictionary, SettingsButton.SelectedSprite.Texture, CurrentMenu.X, CurrentMenu.Y + SettingsButton.SelectedSprite.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.SelectedSprite.Width + CurrentMenu.WidthOffset, SettingsButton.SelectedSprite.Height) 69 | LeftArrowHovered = RageUI.IsMouseInBounds(CurrentMenu.X + SettingsSlider.LeftArrow.X + CurrentMenu.SafeZoneSize.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsSlider.LeftArrow.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.LeftArrow.Width, SettingsSlider.LeftArrow.Height) 70 | RightArrowHovered = RageUI.IsMouseInBounds(CurrentMenu.X + SettingsSlider.RightArrow.X + CurrentMenu.SafeZoneSize.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsSlider.RightArrow.Y + CurrentMenu.SafeZoneSize.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.RightArrow.Width, SettingsSlider.RightArrow.Height) 71 | end 72 | if Enabled == true or Enabled == nil then 73 | if Selected then 74 | if Style.RightLabel ~= nil and Style.RightLabel ~= "" then 75 | RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 0, 0, 0, 255, 2) 76 | RightOffset = MeasureStringWidth(Style.RightLabel, 0, 0.35) 77 | end 78 | else 79 | if Style.RightLabel ~= nil and Style.RightLabel ~= "" then 80 | RightOffset = MeasureStringWidth(Style.RightLabel, 0, 0.35) 81 | RenderText(Style.RightLabel, CurrentMenu.X + SettingsButton.RightText.X - RightBadgeOffset + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightText.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.RightText.Scale, 245, 245, 245, 255, 2) 82 | end 83 | end 84 | end 85 | RightOffset = RightOffset + RightBadgeOffset 86 | if Enabled == true or Enabled == nil then 87 | if Selected then 88 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 0, 0, 0, 255) 89 | 90 | RenderSprite(SettingsSlider.LeftArrow.Dictionary, SettingsSlider.LeftArrow.Texture, CurrentMenu.X + SettingsSlider.LeftArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.LeftArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.LeftArrow.Width, SettingsSlider.LeftArrow.Height, 0, 0, 0, 0, 255) 91 | RenderSprite(SettingsSlider.RightArrow.Dictionary, SettingsSlider.RightArrow.Texture, CurrentMenu.X + SettingsSlider.RightArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.RightArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.RightArrow.Width, SettingsSlider.RightArrow.Height, 0, 0, 0, 0, 255) 92 | else 93 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 245, 245, 245, 255) 94 | end 95 | else 96 | RenderText(Label, CurrentMenu.X + SettingsButton.Text.X + LeftBadgeOffset, CurrentMenu.Y + SettingsButton.Text.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, 0, SettingsButton.Text.Scale, 163, 159, 148, 255) 97 | 98 | if Selected then 99 | RenderSprite(SettingsSlider.LeftArrow.Dictionary, SettingsSlider.LeftArrow.Texture, CurrentMenu.X + SettingsSlider.LeftArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.LeftArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.LeftArrow.Width, SettingsSlider.LeftArrow.Height, 163, 159, 148, 255) 100 | RenderSprite(SettingsSlider.RightArrow.Dictionary, SettingsSlider.RightArrow.Texture, CurrentMenu.X + SettingsSlider.RightArrow.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.RightArrow.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.RightArrow.Width, SettingsSlider.RightArrow.Height, 163, 159, 148, 255) 101 | end 102 | end 103 | 104 | if type(Style) == "table" then 105 | if Style.Enabled == true or Style.Enabled == nil then 106 | if type(Style) == 'table' then 107 | if Style.LeftBadge ~= nil then 108 | if Style.LeftBadge ~= RageUI.BadgeStyle.None then 109 | local BadgeData = Style.LeftBadge(Selected) 110 | 111 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, 0, BadgeData.BadgeColour and BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.A or 255) 112 | end 113 | end 114 | 115 | if Style.RightBadge ~= nil then 116 | if Style.RightBadge ~= RageUI.BadgeStyle.None then 117 | local BadgeData = Style.RightBadge(Selected) 118 | 119 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X + SettingsButton.RightBadge.X + CurrentMenu.WidthOffset, CurrentMenu.Y + SettingsButton.RightBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.RightBadge.Width, SettingsButton.RightBadge.Height, 0, BadgeData.BadgeColour and BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour and BadgeData.BadgeColour.A or 255) 120 | end 121 | end 122 | end 123 | else 124 | ---@type table 125 | local LeftBadge = RageUI.BadgeStyle.Lock 126 | 127 | if LeftBadge ~= RageUI.BadgeStyle.None and LeftBadge ~= nil then 128 | local BadgeData = LeftBadge(Selected) 129 | 130 | RenderSprite(BadgeData.BadgeDictionary or "commonmenu", BadgeData.BadgeTexture or "", CurrentMenu.X, CurrentMenu.Y + SettingsButton.LeftBadge.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsButton.LeftBadge.Width, SettingsButton.LeftBadge.Height, 0, BadgeData.BadgeColour.R or 255, BadgeData.BadgeColour.G or 255, BadgeData.BadgeColour.B or 255, BadgeData.BadgeColour.A or 255) 131 | end 132 | end 133 | else 134 | error("UICheckBox Style is not a `table`") 135 | end 136 | 137 | -- (((SettingsSlider.Slider.Width) / (#Items - 1)) * (ProgressStart - 1)) 138 | 139 | if (type(Style.ProgressBackgroundColor) == "table") then 140 | RenderRectangle(CurrentMenu.X + SettingsSlider.Background.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.Background.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, SettingsSlider.Background.Width, SettingsSlider.Background.Height, Style.ProgressBackgroundColor.R, Style.ProgressBackgroundColor.G, Style.ProgressBackgroundColor.B, Style.ProgressBackgroundColor.A) 141 | else 142 | error("Style ProgressBackgroundColor is not a table or undefined") 143 | end 144 | 145 | if (type(Style.ProgressColor) == "table") then 146 | RenderRectangle(CurrentMenu.X + SettingsSlider.Slider.X + CurrentMenu.WidthOffset - RightOffset, CurrentMenu.Y + SettingsSlider.Slider.Y + CurrentMenu.SubtitleHeight + RageUI.ItemOffset, (((SettingsSlider.Slider.Width) / (#Items - 1)) * (ProgressStart - 1)), SettingsSlider.Slider.Height, Style.ProgressColor.R, Style.ProgressColor.G, Style.ProgressColor.B, Style.ProgressColor.A) 147 | else 148 | error("Style ProgressColor is not a table or undefined") 149 | end 150 | 151 | RageUI.ItemOffset = RageUI.ItemOffset + SettingsButton.Rectangle.Height 152 | 153 | RageUI.ItemsDescription(CurrentMenu, Description, Selected); 154 | 155 | if Selected and (CurrentMenu.Controls.Left.Active or (CurrentMenu.Controls.Click.Active and LeftArrowHovered)) and not (CurrentMenu.Controls.Right.Active or (CurrentMenu.Controls.Click.Active and RightArrowHovered)) then 156 | ProgressStart = ProgressStart - 1 157 | if ProgressStart < 1 then 158 | ProgressStart = #Items 159 | end 160 | 161 | RageUI.PlaySound(Audio[Audio.Use].LeftRight.audioName, Audio[Audio.Use].LeftRight.audioRef) 162 | elseif Selected and (CurrentMenu.Controls.Right.Active or (CurrentMenu.Controls.Click.Active and RightArrowHovered)) and not (CurrentMenu.Controls.Left.Active or (CurrentMenu.Controls.Click.Active and LeftArrowHovered)) then 163 | ProgressStart = ProgressStart + 1 164 | if ProgressStart > #Items then 165 | ProgressStart = 1 166 | end 167 | 168 | RageUI.PlaySound(Audio[Audio.Use].LeftRight.audioName, Audio[Audio.Use].LeftRight.audioRef) 169 | end 170 | 171 | if Selected and (CurrentMenu.Controls.Select.Active or ((Hovered and CurrentMenu.Controls.Click.Active) and (not LeftArrowHovered and not RightArrowHovered))) then 172 | RageUI.PlaySound(Audio[Audio.Use].Select.audioName, Audio[Audio.Use].Select.audioRef) 173 | end 174 | 175 | if (Enabled) then 176 | Callback(Hovered, Selected, ((CurrentMenu.Controls.Select.Active or ((Hovered and CurrentMenu.Controls.Click.Active) and (not LeftArrowHovered and not RightArrowHovered))) and Selected), ProgressStart) 177 | end 178 | end 179 | 180 | RageUI.Options = RageUI.Options + 1 181 | end 182 | end 183 | end 184 | 185 | 186 | -------------------------------------------------------------------------------- /vendors/RageUI/menu/MenuController.lua: -------------------------------------------------------------------------------- 1 | ---@type table 2 | RageUI.LastControl = false 3 | 4 | ---IsMouseInBounds 5 | ---@param X number 6 | ---@param Y number 7 | ---@param Width number 8 | ---@param Height number 9 | ---@return number 10 | ---@public 11 | function RageUI.IsMouseInBounds(X, Y, Width, Height) 12 | local MX, MY = math.round(GetControlNormal(0, 239) * 1920) / 1920, math.round(GetControlNormal(0, 240) * 1080) / 1080 13 | X, Y = X / 1920, Y / 1080 14 | Width, Height = Width / 1920, Height / 1080 15 | return (MX >= X and MX <= X + Width) and (MY > Y and MY < Y + Height) 16 | end 17 | 18 | ---GetSafeZoneBounds 19 | ---@return table 20 | ---@public 21 | function RageUI.GetSafeZoneBounds() 22 | local SafeSize = GetSafeZoneSize() 23 | SafeSize = math.round(SafeSize, 2) 24 | SafeSize = (SafeSize * 100) - 90 25 | SafeSize = 10 - SafeSize 26 | 27 | local W, H = 1920, 1080 28 | 29 | return { X = math.round(SafeSize * ((W / H) * 5.4)), Y = math.round(SafeSize * 5.4) } 30 | end 31 | ---GoUp 32 | ---@param Options number 33 | ---@return nil 34 | ---@public 35 | function RageUI.GoUp(Options) 36 | if RageUI.CurrentMenu ~= nil then 37 | Options = RageUI.CurrentMenu.Options 38 | if RageUI.CurrentMenu() then 39 | if (Options ~= 0) then 40 | if Options > RageUI.CurrentMenu.Pagination.Total then 41 | if RageUI.CurrentMenu.Index <= RageUI.CurrentMenu.Pagination.Minimum then 42 | if RageUI.CurrentMenu.Index == 1 then 43 | RageUI.CurrentMenu.Pagination.Minimum = Options - (RageUI.CurrentMenu.Pagination.Total - 1) 44 | RageUI.CurrentMenu.Pagination.Maximum = Options 45 | RageUI.CurrentMenu.Index = Options 46 | else 47 | RageUI.CurrentMenu.Pagination.Minimum = (RageUI.CurrentMenu.Pagination.Minimum - 1) 48 | RageUI.CurrentMenu.Pagination.Maximum = (RageUI.CurrentMenu.Pagination.Maximum - 1) 49 | RageUI.CurrentMenu.Index = RageUI.CurrentMenu.Index - 1 50 | end 51 | else 52 | RageUI.CurrentMenu.Index = RageUI.CurrentMenu.Index - 1 53 | end 54 | else 55 | if RageUI.CurrentMenu.Index == 1 then 56 | RageUI.CurrentMenu.Pagination.Minimum = Options - (RageUI.CurrentMenu.Pagination.Total - 1) 57 | RageUI.CurrentMenu.Pagination.Maximum = Options 58 | RageUI.CurrentMenu.Index = Options 59 | else 60 | RageUI.CurrentMenu.Index = RageUI.CurrentMenu.Index - 1 61 | end 62 | end 63 | 64 | local Audio = RageUI.Settings.Audio 65 | RageUI.PlaySound(Audio[Audio.Use].UpDown.audioName, Audio[Audio.Use].UpDown.audioRef) 66 | RageUI.LastControl = true 67 | else 68 | local Audio = RageUI.Settings.Audio 69 | RageUI.PlaySound(Audio[Audio.Use].Error.audioName, Audio[Audio.Use].Error.audioRef) 70 | end 71 | end 72 | end 73 | end 74 | 75 | ---GoDown 76 | ---@param Options number 77 | ---@return nil 78 | ---@public 79 | function RageUI.GoDown(Options) 80 | if RageUI.CurrentMenu ~= nil then 81 | Options = RageUI.CurrentMenu.Options 82 | if RageUI.CurrentMenu() then 83 | if (Options ~= 0) then 84 | if Options > RageUI.CurrentMenu.Pagination.Total then 85 | if RageUI.CurrentMenu.Index >= RageUI.CurrentMenu.Pagination.Maximum then 86 | if RageUI.CurrentMenu.Index == Options then 87 | RageUI.CurrentMenu.Pagination.Minimum = 1 88 | RageUI.CurrentMenu.Pagination.Maximum = RageUI.CurrentMenu.Pagination.Total 89 | RageUI.CurrentMenu.Index = 1 90 | else 91 | RageUI.CurrentMenu.Pagination.Maximum = (RageUI.CurrentMenu.Pagination.Maximum + 1) 92 | RageUI.CurrentMenu.Pagination.Minimum = RageUI.CurrentMenu.Pagination.Maximum - (RageUI.CurrentMenu.Pagination.Total - 1) 93 | RageUI.CurrentMenu.Index = RageUI.CurrentMenu.Index + 1 94 | end 95 | else 96 | RageUI.CurrentMenu.Index = RageUI.CurrentMenu.Index + 1 97 | end 98 | else 99 | if RageUI.CurrentMenu.Index == Options then 100 | RageUI.CurrentMenu.Pagination.Minimum = 1 101 | RageUI.CurrentMenu.Pagination.Maximum = RageUI.CurrentMenu.Pagination.Total 102 | RageUI.CurrentMenu.Index = 1 103 | else 104 | RageUI.CurrentMenu.Index = RageUI.CurrentMenu.Index + 1 105 | end 106 | end 107 | local Audio = RageUI.Settings.Audio 108 | RageUI.PlaySound(Audio[Audio.Use].UpDown.audioName, Audio[Audio.Use].UpDown.audioRef) 109 | RageUI.LastControl = false 110 | else 111 | local Audio = RageUI.Settings.Audio 112 | RageUI.PlaySound(Audio[Audio.Use].Error.audioName, Audio[Audio.Use].Error.audioRef) 113 | end 114 | end 115 | end 116 | end 117 | 118 | function RageUI.GoLeft(Controls) 119 | if Controls.Left.Enabled then 120 | for Index = 1, #Controls.Left.Keys do 121 | if not Controls.Left.Pressed then 122 | if IsDisabledControlJustPressed(Controls.Left.Keys[Index][1], Controls.Left.Keys[Index][2]) then 123 | Controls.Left.Pressed = true 124 | 125 | Citizen.CreateThread(function() 126 | Controls.Left.Active = true 127 | 128 | Citizen.Wait(0.01) 129 | 130 | Controls.Left.Active = false 131 | 132 | Citizen.Wait(174.99) 133 | 134 | while Controls.Left.Enabled and IsDisabledControlPressed(Controls.Left.Keys[Index][1], Controls.Left.Keys[Index][2]) do 135 | Controls.Left.Active = true 136 | 137 | Citizen.Wait(0.01) 138 | 139 | Controls.Left.Active = false 140 | 141 | Citizen.Wait(124.99) 142 | end 143 | 144 | Controls.Left.Pressed = false 145 | Wait(10) 146 | end) 147 | 148 | break 149 | end 150 | end 151 | end 152 | end 153 | end 154 | 155 | function RageUI.GoRight(Controls) 156 | if Controls.Right.Enabled then 157 | for Index = 1, #Controls.Right.Keys do 158 | if not Controls.Right.Pressed then 159 | if IsDisabledControlJustPressed(Controls.Right.Keys[Index][1], Controls.Right.Keys[Index][2]) then 160 | Controls.Right.Pressed = true 161 | 162 | Citizen.CreateThread(function() 163 | Controls.Right.Active = true 164 | 165 | Citizen.Wait(0.01) 166 | 167 | Controls.Right.Active = false 168 | 169 | Citizen.Wait(174.99) 170 | 171 | while Controls.Right.Enabled and IsDisabledControlPressed(Controls.Right.Keys[Index][1], Controls.Right.Keys[Index][2]) do 172 | Controls.Right.Active = true 173 | 174 | Citizen.Wait(1) 175 | 176 | Controls.Right.Active = false 177 | 178 | Citizen.Wait(124.99) 179 | end 180 | 181 | Controls.Right.Pressed = false 182 | Wait(10) 183 | end) 184 | 185 | break 186 | end 187 | end 188 | end 189 | end 190 | end 191 | 192 | function RageUI.GoSliderLeft(Controls) 193 | if Controls.SliderLeft.Enabled then 194 | for Index = 1, #Controls.SliderLeft.Keys do 195 | if not Controls.SliderLeft.Pressed then 196 | if IsDisabledControlJustPressed(Controls.SliderLeft.Keys[Index][1], Controls.SliderLeft.Keys[Index][2]) then 197 | Controls.SliderLeft.Pressed = true 198 | Citizen.CreateThread(function() 199 | Controls.SliderLeft.Active = true 200 | Citizen.Wait(1) 201 | Controls.SliderLeft.Active = false 202 | while Controls.SliderLeft.Enabled and IsDisabledControlPressed(Controls.SliderLeft.Keys[Index][1], Controls.SliderLeft.Keys[Index][2]) do 203 | Controls.SliderLeft.Active = true 204 | Citizen.Wait(1) 205 | Controls.SliderLeft.Active = false 206 | end 207 | Controls.SliderLeft.Pressed = false 208 | end) 209 | break 210 | end 211 | end 212 | end 213 | end 214 | end 215 | 216 | function RageUI.GoSliderRight(Controls) 217 | if Controls.SliderRight.Enabled then 218 | for Index = 1, #Controls.SliderRight.Keys do 219 | if not Controls.SliderRight.Pressed then 220 | if IsDisabledControlJustPressed(Controls.SliderRight.Keys[Index][1], Controls.SliderRight.Keys[Index][2]) then 221 | Controls.SliderRight.Pressed = true 222 | Citizen.CreateThread(function() 223 | Controls.SliderRight.Active = true 224 | Citizen.Wait(1) 225 | Controls.SliderRight.Active = false 226 | while Controls.SliderRight.Enabled and IsDisabledControlPressed(Controls.SliderRight.Keys[Index][1], Controls.SliderRight.Keys[Index][2]) do 227 | Controls.SliderRight.Active = true 228 | Citizen.Wait(1) 229 | Controls.SliderRight.Active = false 230 | end 231 | Controls.SliderRight.Pressed = false 232 | end) 233 | break 234 | end 235 | end 236 | end 237 | end 238 | end 239 | 240 | ---Controls 241 | ---@return nil 242 | ---@public 243 | function RageUI.Controls() 244 | if RageUI.CurrentMenu ~= nil then 245 | if RageUI.CurrentMenu() then 246 | if RageUI.CurrentMenu.Open then 247 | 248 | local Controls = RageUI.CurrentMenu.Controls; 249 | ---@type number 250 | local Options = RageUI.CurrentMenu.Options 251 | RageUI.Options = RageUI.CurrentMenu.Options 252 | if RageUI.CurrentMenu.EnableMouse then 253 | DisableAllControlActions(2) 254 | end 255 | 256 | if not IsInputDisabled(2) then 257 | for Index = 1, #Controls.Enabled.Controller do 258 | EnableControlAction(Controls.Enabled.Controller[Index][1], Controls.Enabled.Controller[Index][2], true) 259 | end 260 | else 261 | for Index = 1, #Controls.Enabled.Keyboard do 262 | EnableControlAction(Controls.Enabled.Keyboard[Index][1], Controls.Enabled.Keyboard[Index][2], true) 263 | end 264 | end 265 | 266 | if Controls.Up.Enabled then 267 | for Index = 1, #Controls.Up.Keys do 268 | if not Controls.Up.Pressed then 269 | if IsDisabledControlJustPressed(Controls.Up.Keys[Index][1], Controls.Up.Keys[Index][2]) then 270 | Controls.Up.Pressed = true 271 | 272 | Citizen.CreateThread(function() 273 | RageUI.GoUp(Options) 274 | 275 | Citizen.Wait(175) 276 | 277 | while Controls.Up.Enabled and IsDisabledControlPressed(Controls.Up.Keys[Index][1], Controls.Up.Keys[Index][2]) do 278 | RageUI.GoUp(Options) 279 | 280 | Citizen.Wait(50) 281 | end 282 | 283 | Controls.Up.Pressed = false 284 | end) 285 | 286 | break 287 | end 288 | end 289 | end 290 | end 291 | 292 | if Controls.Down.Enabled then 293 | for Index = 1, #Controls.Down.Keys do 294 | if not Controls.Down.Pressed then 295 | if IsDisabledControlJustPressed(Controls.Down.Keys[Index][1], Controls.Down.Keys[Index][2]) then 296 | Controls.Down.Pressed = true 297 | 298 | Citizen.CreateThread(function() 299 | RageUI.GoDown(Options) 300 | 301 | Citizen.Wait(175) 302 | 303 | while Controls.Down.Enabled and IsDisabledControlPressed(Controls.Down.Keys[Index][1], Controls.Down.Keys[Index][2]) do 304 | RageUI.GoDown(Options) 305 | 306 | Citizen.Wait(50) 307 | end 308 | 309 | Controls.Down.Pressed = false 310 | end) 311 | 312 | break 313 | end 314 | end 315 | end 316 | end 317 | 318 | RageUI.GoLeft(Controls) 319 | --- Default Left navigation 320 | RageUI.GoRight(Controls) --- Default Right navigation 321 | 322 | RageUI.GoSliderLeft(Controls) 323 | RageUI.GoSliderRight(Controls) 324 | 325 | if Controls.Select.Enabled then 326 | for Index = 1, #Controls.Select.Keys do 327 | if not Controls.Select.Pressed then 328 | if IsDisabledControlJustPressed(Controls.Select.Keys[Index][1], Controls.Select.Keys[Index][2]) then 329 | Controls.Select.Pressed = true 330 | 331 | Citizen.CreateThread(function() 332 | Controls.Select.Active = true 333 | 334 | Citizen.Wait(0.01) 335 | 336 | Controls.Select.Active = false 337 | 338 | Citizen.Wait(174.99) 339 | 340 | while Controls.Select.Enabled and IsDisabledControlPressed(Controls.Select.Keys[Index][1], Controls.Select.Keys[Index][2]) do 341 | Controls.Select.Active = true 342 | 343 | Citizen.Wait(0.01) 344 | 345 | Controls.Select.Active = false 346 | 347 | Citizen.Wait(124.99) 348 | end 349 | 350 | Controls.Select.Pressed = false 351 | 352 | end) 353 | 354 | break 355 | end 356 | end 357 | end 358 | end 359 | 360 | if Controls.Click.Enabled then 361 | for Index = 1, #Controls.Click.Keys do 362 | if not Controls.Click.Pressed then 363 | if IsDisabledControlJustPressed(Controls.Click.Keys[Index][1], Controls.Click.Keys[Index][2]) then 364 | Controls.Click.Pressed = true 365 | 366 | Citizen.CreateThread(function() 367 | Controls.Click.Active = true 368 | 369 | Citizen.Wait(0.01) 370 | 371 | Controls.Click.Active = false 372 | 373 | Citizen.Wait(174.99) 374 | 375 | while Controls.Click.Enabled and IsDisabledControlPressed(Controls.Click.Keys[Index][1], Controls.Click.Keys[Index][2]) do 376 | Controls.Click.Active = true 377 | 378 | Citizen.Wait(0.01) 379 | 380 | Controls.Click.Active = false 381 | 382 | Citizen.Wait(124.99) 383 | end 384 | 385 | Controls.Click.Pressed = false 386 | end) 387 | 388 | break 389 | end 390 | end 391 | end 392 | end 393 | if Controls.Back.Enabled then 394 | for Index = 1, #Controls.Back.Keys do 395 | if not Controls.Back.Pressed then 396 | if IsDisabledControlJustPressed(Controls.Back.Keys[Index][1], Controls.Back.Keys[Index][2]) then 397 | Controls.Back.Pressed = true 398 | Wait(10) 399 | break 400 | end 401 | end 402 | end 403 | end 404 | 405 | end 406 | end 407 | end 408 | end 409 | 410 | ---Navigation 411 | ---@return nil 412 | ---@public 413 | function RageUI.Navigation() 414 | if RageUI.CurrentMenu ~= nil then 415 | if RageUI.CurrentMenu() then 416 | if RageUI.CurrentMenu.EnableMouse then 417 | SetMouseCursorActiveThisFrame() 418 | end 419 | if RageUI.Options > RageUI.CurrentMenu.Pagination.Total then 420 | 421 | ---@type boolean 422 | local UpHovered = false 423 | 424 | ---@type boolean 425 | local DownHovered = false 426 | 427 | if not RageUI.CurrentMenu.SafeZoneSize then 428 | RageUI.CurrentMenu.SafeZoneSize = { X = 0, Y = 0 } 429 | 430 | if RageUI.CurrentMenu.Safezone then 431 | RageUI.CurrentMenu.SafeZoneSize = RageUI.GetSafeZoneBounds() 432 | 433 | SetScriptGfxAlign(76, 84) 434 | SetScriptGfxAlignParams(0, 0, 0, 0) 435 | end 436 | end 437 | 438 | UpHovered = RageUI.IsMouseInBounds(RageUI.CurrentMenu.X + RageUI.CurrentMenu.SafeZoneSize.X, RageUI.CurrentMenu.Y + RageUI.CurrentMenu.SafeZoneSize.Y + RageUI.CurrentMenu.SubtitleHeight + RageUI.ItemOffset, RageUI.Settings.Items.Navigation.Rectangle.Width + RageUI.CurrentMenu.WidthOffset, RageUI.Settings.Items.Navigation.Rectangle.Height) 439 | DownHovered = RageUI.IsMouseInBounds(RageUI.CurrentMenu.X + RageUI.CurrentMenu.SafeZoneSize.X, RageUI.CurrentMenu.Y + RageUI.Settings.Items.Navigation.Rectangle.Height + RageUI.CurrentMenu.SafeZoneSize.Y + RageUI.CurrentMenu.SubtitleHeight + RageUI.ItemOffset, RageUI.Settings.Items.Navigation.Rectangle.Width + RageUI.CurrentMenu.WidthOffset, RageUI.Settings.Items.Navigation.Rectangle.Height) 440 | 441 | if RageUI.CurrentMenu.EnableMouse then 442 | 443 | 444 | if RageUI.CurrentMenu.Controls.Click.Active then 445 | if UpHovered then 446 | RageUI.GoUp(RageUI.Options) 447 | elseif DownHovered then 448 | RageUI.GoDown(RageUI.Options) 449 | end 450 | end 451 | 452 | if UpHovered then 453 | RenderRectangle(RageUI.CurrentMenu.X, RageUI.CurrentMenu.Y + RageUI.CurrentMenu.SubtitleHeight + RageUI.ItemOffset, RageUI.Settings.Items.Navigation.Rectangle.Width + RageUI.CurrentMenu.WidthOffset, RageUI.Settings.Items.Navigation.Rectangle.Height, 30, 30, 30, 255) 454 | else 455 | RenderRectangle(RageUI.CurrentMenu.X, RageUI.CurrentMenu.Y + RageUI.CurrentMenu.SubtitleHeight + RageUI.ItemOffset, RageUI.Settings.Items.Navigation.Rectangle.Width + RageUI.CurrentMenu.WidthOffset, RageUI.Settings.Items.Navigation.Rectangle.Height, 0, 0, 0, 200) 456 | end 457 | 458 | if DownHovered then 459 | RenderRectangle(RageUI.CurrentMenu.X, RageUI.CurrentMenu.Y + RageUI.Settings.Items.Navigation.Rectangle.Height + RageUI.CurrentMenu.SubtitleHeight + RageUI.ItemOffset, RageUI.Settings.Items.Navigation.Rectangle.Width + RageUI.CurrentMenu.WidthOffset, RageUI.Settings.Items.Navigation.Rectangle.Height, 30, 30, 30, 255) 460 | else 461 | RenderRectangle(RageUI.CurrentMenu.X, RageUI.CurrentMenu.Y + RageUI.Settings.Items.Navigation.Rectangle.Height + RageUI.CurrentMenu.SubtitleHeight + RageUI.ItemOffset, RageUI.Settings.Items.Navigation.Rectangle.Width + RageUI.CurrentMenu.WidthOffset, RageUI.Settings.Items.Navigation.Rectangle.Height, 0, 0, 0, 200) 462 | end 463 | else 464 | RenderRectangle(RageUI.CurrentMenu.X, RageUI.CurrentMenu.Y + RageUI.CurrentMenu.SubtitleHeight + RageUI.ItemOffset, RageUI.Settings.Items.Navigation.Rectangle.Width + RageUI.CurrentMenu.WidthOffset, RageUI.Settings.Items.Navigation.Rectangle.Height, 0, 0, 0, 200) 465 | RenderRectangle(RageUI.CurrentMenu.X, RageUI.CurrentMenu.Y + RageUI.Settings.Items.Navigation.Rectangle.Height + RageUI.CurrentMenu.SubtitleHeight + RageUI.ItemOffset, RageUI.Settings.Items.Navigation.Rectangle.Width + RageUI.CurrentMenu.WidthOffset, RageUI.Settings.Items.Navigation.Rectangle.Height, 0, 0, 0, 200) 466 | end 467 | RenderSprite(RageUI.Settings.Items.Navigation.Arrows.Dictionary, RageUI.Settings.Items.Navigation.Arrows.Texture, RageUI.CurrentMenu.X + RageUI.Settings.Items.Navigation.Arrows.X + (RageUI.CurrentMenu.WidthOffset / 2), RageUI.CurrentMenu.Y + RageUI.Settings.Items.Navigation.Arrows.Y + RageUI.CurrentMenu.SubtitleHeight + RageUI.ItemOffset, RageUI.Settings.Items.Navigation.Arrows.Width, RageUI.Settings.Items.Navigation.Arrows.Height) 468 | 469 | RageUI.ItemOffset = RageUI.ItemOffset + (RageUI.Settings.Items.Navigation.Rectangle.Height * 2) 470 | 471 | end 472 | end 473 | end 474 | end 475 | 476 | ---GoBack 477 | ---@return nil 478 | ---@public 479 | function RageUI.GoBack() 480 | if RageUI.CurrentMenu ~= nil then 481 | local Audio = RageUI.Settings.Audio 482 | RageUI.PlaySound(Audio[Audio.Use].Back.audioName, Audio[Audio.Use].Back.audioRef) 483 | if RageUI.CurrentMenu.Parent ~= nil then 484 | if RageUI.CurrentMenu.Parent() then 485 | RageUI.NextMenu = RageUI.CurrentMenu.Parent 486 | else 487 | RageUI.NextMenu = nil 488 | RageUI.Visible(RageUI.CurrentMenu, false) 489 | end 490 | else 491 | RageUI.NextMenu = nil 492 | RageUI.Visible(RageUI.CurrentMenu, false) 493 | end 494 | end 495 | end 496 | --------------------------------------------------------------------------------