1x1 Posted May 19, 2022 Share Posted May 19, 2022 Hi so i got this code from Lover1500 local selection = {false, false} function start() local multiMenu = gg.multiChoice({'hack health', 'hack mana', 'Exit'}, selection) if not multiMenu then return end if multiMenu[3] then print('Exited') os.exit() end selection = multiMenu end while true do if gg.isVisible(true) then gg.setVisible(false) start() end end And i just wanna make it 1 only. Example: local selection = {false, false} function start() local multiMenu = gg.multiChoice({'Skip Game', 'Infinite Ammo', 'Exit'}, selection) if not multiMenu then return end if multiMenu[3] then print('Exited') os.exit() end if multiMenu[1] == true then gg.toast('GAME SKIPPED') end if multiMenu[2] == true then gg.toast('ON') else gg.toast('OFF') end selection = multiMenu end while true do if gg.isVisible(true) then gg.setVisible(false) start() end end But the problem i don't want to Remember all. I wanna make Skip Game just 1 check and done, while Infinite Ammo is Check and Uncheck. Pls Help Link to comment Share on other sites More sharing options...
CmP Posted May 26, 2022 Share Posted May 26, 2022 Preserving selection state only of some menu items can be done by adding a table for specifying menu items whose selection state needs to be preserved and updating "selection" table after the call to "multiChoice" function according to the added table and user's selection of items. Here is an example of how it can be implemented based on your code: function updateSelection(selection, keysToUpdate, newSelection) newSelection = newSelection or {} for i = 1, #selection do if keysToUpdate[i] then -- if item's selection state needs to be updated selection[i] = newSelection[i] or false -- update item's selection state and ensure that new value is not nil else selection[i] = false -- reset item's selection state to unselected end end end local options = {'Skip Game', 'Infinite Ammo', 'Exit'} local selection = {false, false, false} local remember = {[2] = true} function start() local choices = gg.multiChoice(options, selection) updateSelection(selection, remember, choices) if choices == nil then return end if choices[3] then print('Exited') os.exit() end if choices[1] then gg.toast('GAME SKIPPED') end if choices[2] then gg.toast('ON') else gg.toast('OFF') end end while true do if gg.isVisible() then gg.setVisible(false) start() end gg.sleep(100) end Link to comment Share on other sites More sharing options...
Question
1x1
Hi so i got this code from Lover1500
And i just wanna make it 1 only.
Example:
But the problem i don't want to Remember all. I wanna make Skip Game just 1 check and done, while Infinite Ammo is Check and Uncheck.
Pls Help
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.