Facebook
From Angelika, 1 Month ago, written in Lua.
Embed
Download Paste or View Raw
Hits: 124
  1. -- Define a table of cheat options
  2. local cheatOptions = {
  3.     {name = "No Damage", enabled = false},
  4.     {name = "Infinite Money", enabled = false},
  5.     {name = "Infinite Nitro", enabled = false}
  6. }
  7.  
  8. -- Function to print centered text
  9. local function printCentered(text)
  10.     local lineLength = 40
  11.     local margin = math.floor((lineLength - string.len(text)) / 2)
  12.     print(string.rep(" ", margin) .. text)
  13. end
  14.  
  15. -- Function to display the cheat menu
  16. local function displayCheatMenu()
  17.     printCentered("===== Game Extreme Car Driving Simulator Cheat Menu =====")
  18.     for i, option in ipairs(cheatOptions) do
  19.         print(i .. ". " .. option.name .. ": " .. (option.enabled and "ON" or "OFF"))
  20.     end
  21.     printCentered("====================================================")
  22. end
  23.  
  24. -- Function to toggle a cheat option by its index
  25. local function toggleCheatOption(index)
  26.     if cheatOptions[index] then
  27.         cheatOptions[index].enabled = not cheatOptions[index].enabled
  28.     end
  29. end
  30.  
  31. -- Function to toggle a cheat option by its name
  32. local function toggleCheatOptionByName(name)
  33.     for i, option in ipairs(cheatOptions) do
  34.         if option.name == name then
  35.             option.enabled = not option.enabled
  36.             return
  37.         end
  38.     end
  39.     print("Cheat option not found")
  40. end
  41.  
  42. -- Function to exit the game
  43. local function exitGame()
  44.     os.exit()
  45. end
  46.  
  47. -- Game loop
  48. while true do
  49.     -- Display the cheat menu
  50.     displayCheatMenu()
  51.  
  52.     -- Get user input
  53.     print("Enter a cheat option to toggle (or 'exit' to quit):")
  54.     local input = io.read()
  55.  
  56.     if input == "exit" then
  57.         -- Exit the game
  58.         exitGame()
  59.     else
  60.         -- Try to toggle cheat option by its name
  61.         toggleCheatOptionByName(input)
  62.     end
  63. end