Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Creation des menus et sous-menus
- local mainMenu = RageUI.CreateMenu("Menu principal", "Animaux")
- local acheterMenu = RageUI.CreateSubMenu(mainMenu, "Acheter des animaux", "Choisissez les animaux à acheter")
- local confirmerMenu = RageUI.CreateSubMenu(mainMenu, "Confirmer l'achat", " Êtes-vous sûr de vouloir acheter ces animaux?")
- local achatConfirmeMenu = RageUI.CreateSubMenu(mainMenu, "Achat confirmé", "Votre achat a été effectué avec succés.")
- -- Definition des variables pour les indexs de liste
- local poulesIndex, cochonsIndex, vachesIndex
- -- Fonction d'ouverture du menu
- function OpenMenu()
- RageUI.Visible(mainMenu, not RageUI.Visible(mainMenu))
- -- Initialisation des variables d'index
- poulesIndex, cochonsIndex, vachesIndex = 1, 1, 1
- end
- local function closeMenu()
- RageUI.CloseAll()
- end
- -- Affichage du menu
- function RageUI.PoolMenus:Boucher()
- -- Main menu
- mainMenu:IsVisible(function(Items)
- -- Ajout d'un bouton pour passer a l'achat d'animaux
- Items:AddButton("Acheter un animal", nil, { RightLabel = "ENTER" }, function(onSelected) end, acheterMenu)
- -- Ajout d'un bouton pour passer au traitement des animaux
- Items:AddButton("S'occuper des animaux possédés", nil, { RightLabel = "ENTER" }, function(onSelected) end, function(onClick) print("click") end)
- -- Ajout d'un bouton de Retour
- Items:AddButton("Retour", nil, { RightLabel = "BACKSPACE" }, function(onSelected) end, function()
- RageUI.GoBack()
- end)
- end, function(Panels) end)
- -- Menu de la selection d'animaux a acheter
- acheterMenu:IsVisible(function(Items)
- -- Section des poules
- Items:AddList("Poules", {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}, poulesIndex, nil, {IsDisabled = false}, function(Index, onSelected, onListChange)
- if (onListChange) then
- poulesIndex = Index;
- end
- end)
- -- Section des cochons
- Items:AddList("Cochons", {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, cochonsIndex, nil, {IsDisabled = false}, function(Index, onSelected, onListChange)
- if (onListChange) then
- cochonsIndex = Index;
- end
- end)
- -- Section des vaches
- Items:AddList("Vaches", {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, vachesIndex, nil, {IsDisabled = false}, function(Index, onSelected, onListChange)
- if (onListChange) then
- vachesIndex = Index;
- end
- end)
- -- Ajout d'un bouton pour passer a l'achat
- Items:AddButton("Passer à l'achat", nil, { RightLabel = "ENTER" }, function(onSelected) end, confirmerMenu)
- -- Ajout d'un bouton de Retour
- Items:AddButton("Retour", nil, { RightLabel = "BACKSPACE" }, function(onSelected) end, function()
- RageUI.GoBack()
- end)
- end, function(Panels) end)
- -- Menu de confirmation de l'achat
- confirmerMenu:IsVisible(function(Items)
- -- Affichage du panier du joueur
- Items:AddSeparator("Vous vous apprétez à acheter:")
- Items:AddSeparator("~b~"..(poulesIndex-1).." poules")
- Items:AddSeparator("~b~"..(cochonsIndex-1).." cochons")
- Items:AddSeparator("~b~"..(vachesIndex-1).." vaches")
- -- Affichage du tarif
- Items:AddSeparator("Cela vous coûtera ~r~"..((poulesIndex-1) * 250) + ((cochonsIndex-1) * 750) + ((vachesIndex-1) * 1000).."$")
- -- Ajout d'un bouton de confirmation d'achat
- Items:AddButton("Confirmer l'achat", nil, { RightLabel = 0x0D }, function(onSelected)
- -- Si le joueur valide
- if onSelected then
- -- Trigger de l'event serveur pour l'achat d'annimaux
- TriggerServerEvent("acheterAnimaux", (poulesIndex-1), (cochonsIndex-1), (vachesIndex-1))
- --poulesIndex, cochonsIndex, vachesIndex = 1, 1, 1
- end
- end, achatConfirmeMenu)
- -- Ajout d'un bouton d'annulation
- Items:AddButton("Annuler", nil, { RightLabel = "BACKSPACE" }, function(onSelected) end, function()
- RageUI.GoBack()
- end)
- end, function(Panels) end)
- -- Menu de confirmant que l'achat a ete effectue
- achatConfirmeMenu:IsVisible(function(Items)
- Items:AddSeparator("Votre achat a été effectué avec succès.")
- -- Ajout d'un bouton pour fermer le menu
- Items:AddButton("Fermer", nil, { }, function(onSelected) end, function()
- end)
- end, function(Panels) end)
- end
Advertisement
Add Comment
Please, Sign In to add comment