Facebook
From Angelika, 1 Month ago, written in Lua.
Embed
Download Paste or View Raw
Hits: 135
  1. -- Define a table of mod options
  2. local modOptions = {
  3.     { name = "Speed Hack", enabled = false, value = 1.0 },
  4.     { name = "Gravity Hack", enabled = false, value = 1.0 },
  5.     { name = "Handling Hack", enabled = false, value = 1.0 },
  6. }
  7.  
  8. -- Function to display the mod menu
  9. local function displayModMenu()
  10.     print("===== Game Extreme Car Driving Simulator Mod Menu =====")
  11.     for i, option in ipairs(modOptions) do
  12.         local status = option.enabled and "ON" or "OFF"
  13.         print(i .. ". " .. option.name .. ": " .. status .. " × " .. option.value)
  14.     end
  15.     print("====================================================")
  16. end
  17.  
  18. -- Function to toggle a mod option
  19. local function toggleModOption(index)
  20.     if type(index) ~= "number" or index < 1 or index > #modOptions then
  21.         print("Invalid mod option index.")
  22.         return
  23.     end
  24.     modOptions[index].enabled = not modOptions[index].enabled
  25. end
  26.  
  27. -- Function to modify a mod option value
  28. local function modifyModOption(index, value)
  29.     if type(index) ~= "number" or index < 1 or index > #modOptions then
  30.         print("Invalid mod option index.")
  31.         return
  32.     end
  33.     if not tonumber(value) then
  34.         print("Invalid mod option value.")
  35.         return
  36.     end
  37.     modOptions[index].value = tonumber(value)
  38. end
  39.  
  40. -- Game loop
  41. while true do
  42.     -- Display the mod menu
  43.     displayModMenu()
  44.  
  45.     -- Get user input
  46.     print("Enter a mod option to modify (or 'exit' to quit):")
  47.     local input = io.read()
  48.  
  49.     if input == "exit" then
  50.         break
  51.     end
  52.  
  53.     local index, value = input:match("(%d+) (%d+%.?%d*)")
  54.     if index then
  55.         toggleModOption(tonumber(index))
  56.     else
  57.         value = input
  58.         index = input:match("(%d+)")
  59.         if index then
  60.             modifyModOption(tonumber(index), value)
  61.         else
  62.             print("Invalid input. Enter a mod option index and value (or 'exit' to quit).")
  63.         end
  64.     end
  65. end