menus = function() 
    return {
        MainMenu = {
            title = "Main Menu",
            parent = nil,  
            items = {
                {
                    label = "Positions", 
                    action = function() 
						addOneOffSound(0, 0, 0, SOUND_CLICK)
                        currentMenu	= 'PosMenu' 
						focusIndex	= 1
                        --printStringNow("Positions action triggered!", 500) 
                    end, 
                    description = "Configure camera positions"
                },
                {
                    label = "Camhack",
                    action = function() 
						addOneOffSound(0, 0, 0, SOUND_CLICK)
                        --printStringNow("Playback action triggered!", 500) 
                    end, 
                    description = "Play recorded audio"
                },
                {
                    label = "Pause", 
                    action = function()
						addOneOffSound(0, 0, 0, SOUND_CLICK)
                        --printStringNow("Pause action triggered!", 500) 
                    end, 
                    description = "Pause current action"
                },
                {
                    label = "Car slot", 
                    action = function() 
						addOneOffSound(0, 0, 0, SOUND_CLICK)
                        --printStringNow("Car slot action triggered!", 500) 
                    end, 
                    description = "Manage car storage"
                },
                {
                    label = "Save/Load", 
                    action = function() 
						addOneOffSound(0, 0, 0, SOUND_CLICK)
                        --printStringNow("Save/Load action triggered!", 500) 
                    end, 
                    description = "Save or load settings"
                },
                {
                    label = "Triggers", 
                    action = function() 
						addOneOffSound(0, 0, 0, SOUND_CLICK)
                        --printStringNow("Triggers action triggered!", 500) 
                    end, 
                    description = "Configure trigger actions"
                },
                {
                    label = "Options", 
                    action = function()
						addOneOffSound(0, 0, 0, SOUND_CLICK)
                        --printStringNow("Options action triggered!", 500) 
						currentMenu	= 'OptionsMenu' 
						focusIndex	= 1
                    end, 
                    description = "Adjust script settings~n~(not camera)"
                },
            }
        },

        PosMenu = {
            title = "Positions",
            parent = "MainMenu",
            items = {
                {
                    label = "Camhack: " .. (camHack.isFlyModeActive and "~g~~h~~h~~h~ON" or "~r~~h~~h~~h~OFF"), 
                    action = function() 
						addOneOffSound(0, 0, 0, SOUND_CLICK)
                        --printStringNow("CamHack!", 500) 
                        camHack.isFlyModeToggleRequested = not camHack.isFlyModeToggleRequested 
						
                    end, 
                    description = "Camhack"
                },
                {
                    label = "Preview:  " .. (previewMode and "~g~~h~~h~~h~ON" or "~r~~h~~h~~h~OFF"), 
                    action = function() 
						addOneOffSound(0, 0, 0, SOUND_CLICK)
						toggleCurrentPreview()
						-- превью из сохранения переместить в клик по переключателю слотов
						-- здесь же оставить превью ТЕКУЩЕЙ камеры
						--[[ 
						previewMode = not previewMode
						
						local previewData = loadCamFromFile(profile, camSlot)
						
						if previewMode then
							if previewData.cameraX and previewData.cameraY and previewData.cameraZ 
							   and previewData.pointX and previewData.pointY and previewData.pointZ then
							   
								camHack.enableWithoutReset = true
								camHack.isFlyModeActive = false
								camHack.isFlyModeToggleRequested = false
								
								setFixedCameraPosition(previewData.cameraX, previewData.cameraY, previewData.cameraZ, 0.0, 0.0, 0.0)
								pointCameraAtPoint(previewData.pointX, previewData.pointY, previewData.pointZ, 2)
							end
						else
							camHack.isFlyModeToggleRequested = true
						end
						]]
						
                        --printStringNow("Preview Camera Position!", 500) 
                    end, 
                    description = "Preview current camera"
                },
                {
                    label = "Cam Slot: " .. camSlot, 
                    action = function() 
						addOneOffSound(0, 0, 0, SOUND_CLICK)
                        --printStringNow("Display Current Camera Slot!", 500) 
                    end, 
                    scrollAction = adjustCamSlot, 
                    description = "Select slot to Load or Save"
                },
                {
                    label = "Save", 
                    action = function() 
						addOneOffSound(0, 0, 0, SOUND_CLICK)
						saveCamToSlot(camSlot)
                        --printStringNow("Save Camera Position!", 500) 
                    end, 
                    description = "Save current camera position to slot"
                },
                {
                    label = "Load", 
                    action = function() 
						addOneOffSound(0, 0, 0, SOUND_CLICK)
						loadCamFromSlot(camSlot)
                        --printStringNow("Load Camera Position!", 500) 
                    end, 
                    description = "Load camera position from slot"
                },
                {
                    label = "", 
                    action = function() 
                    end, 
                    description = ""
                },
                {
                    label = "Back", 
                    action = function() 
                        currentMenu = 'MainMenu'
						focusIndex	= 1
						addOneOffSound(0, 0, 0, SOUND_BACK)
                        --printStringNow("Back to Main Menu!", 500) 
                    end, 
                    description = "Return to the main menu"
                },
            }
        },
		
		OptionsMenu = {
            title = "Positions",
            parent = "MainMenu",
            items = {
                {
                    label = "Camhack", 
                    action = function() 
						addOneOffSound(0, 0, 0, SOUND_CLICK)
                        --printStringNow("CamHack!", 500) 
						currentMenu	= 'CHOptionsMenu' 
						focusIndex	= 1
						
                    end, 
                    description = "Camhack Options"
                },
				{
                    label = "Item1", 
                    action = function() 
						addOneOffSound(0, 0, 0, SOUND_CLICK)
                        --printStringNow("CamHack!", 500) 
						
                    end, 
                    description = "—ћ¬ ¬ ®e џ®a«"
                },
				{
                    label = "Item2", 
                    action = function() 
						addOneOffSound(0, 0, 0, SOUND_CLICK)
                        --printStringNow("CamHack!", 500) 
						
                    end, 
                    description = "—ћ¬ ¬ ®e џ®a«"
                },
				{
					label = "", 
					action = function() 
					end, 
					description = ""
				},
				{
					label = "Back",
					action = function()
						currentMenu = "MainMenu"
						focusIndex = 1
						addOneOffSound(0, 0, 0, SOUND_BACK)
					end,
					description = "Return to the Main Menu."
				}
            }
		},
		
		CHOptionsMenu = {
			title = "Camhack Options",
			parent = "OptionsMenu",
			items = {
				{
					label = "Camhack       " .. (camHack.isFlyModeActive and "~g~~h~~h~~h~ON" or "~r~~h~~h~~h~OFF"),
					action = function()
						addOneOffSound(0, 0, 0, SOUND_CLICK)
						camHack.isFlyModeToggleRequested = not camHack.isFlyModeToggleRequested
					end,
					description = "Toggle fly mode to move the camera freely.~n~~h~Default: OFF."
				},
				{
					label = "Collision        " .. (camHack.isCollisionEnabled and "~g~~h~~h~~h~ON" or "~r~~h~~h~~h~OFF"),
					action = function()
						addOneOffSound(0, 0, 0, SOUND_CLICK)
						camHack.isCollisionEnabled = not camHack.isCollisionEnabled
					end,
					description = "Toggle camera collision with world objects.~n~~h~Default: ON."
				},
				{
					label = "Debug Info    " .. (camHack.shouldRenderDebugInfo and "~g~~h~~h~~h~ON" or "~r~~h~~h~~h~OFF"),
					action = function()
						addOneOffSound(0, 0, 0, SOUND_CLICK)
						camHack.shouldRenderDebugInfo = not camHack.shouldRenderDebugInfo
					end,
					description = "Show or hide camera info.~n~~h~Default: ON."
				},
				{
					label = "Solid Obj       " .. (camHack.checkSolidObjects and "~g~~h~~h~~h~ON" or "~r~~h~~h~~h~OFF"),
					action = function()
						addOneOffSound(0, 0, 0, SOUND_CLICK)
						camHack.checkSolidObjects = not camHack.checkSolidObjects
					end,
					description = "Check collisions with solid(static) objects.~n~~h~Default: ON."
				},
				{
					label = "Vehicles        " .. (camHack.checkVehicles and "~g~~h~~h~~h~ON" or "~r~~h~~h~~h~OFF"),
					action = function()
						addOneOffSound(0, 0, 0, SOUND_CLICK)
						camHack.checkVehicles = not camHack.checkVehicles
					end,
					description = "Check collisions with vehicles.~n~~h~Default: OFF."
				},
				{
					label = "Peds              " .. (camHack.checkPeds and "~g~~h~~h~~h~ON" or "~r~~h~~h~~h~OFF"),
					action = function()
						addOneOffSound(0, 0, 0, SOUND_CLICK)
						camHack.checkPeds = not camHack.checkPeds
					end,
					description = "Check collisions with pedestrians.~n~~h~Default: OFF."
				},
				{
					label = "Objects         " .. (camHack.checkObjects and "~g~~h~~h~~h~ON" or "~r~~h~~h~~h~OFF"),
					action = function()
						addOneOffSound(0, 0, 0, SOUND_CLICK)
						camHack.checkObjects = not camHack.checkObjects
					end,
					description = "Check collisions with dynamic objects.~n~~h~Default: ON."
				},
				{
					label = "Particles       " .. (camHack.checkParticles and "~g~~h~~h~~h~ON" or "~r~~h~~h~~h~OFF"),
					action = function()
						addOneOffSound(0, 0, 0, SOUND_CLICK)
						camHack.checkParticles = not camHack.checkParticles
					end,
					description = "Check collisions with particles.~n~~h~Default: OFF."
				},
				{
					label = "See Through " .. (camHack.seeThroughObjects and "~g~~h~~h~~h~ON" or "~r~~h~~h~~h~OFF"),
					action = function()
						addOneOffSound(0, 0, 0, SOUND_CLICK)
						camHack.seeThroughObjects = not camHack.seeThroughObjects
					end,
					description = "Check collisions with seeing through objects.~n~~h~Default: OFF."
				},
				{
					label = "Ignore Some " .. (camHack.ignoreSomeObjects and "~g~~h~~h~~h~ON" or "~r~~h~~h~~h~OFF"),
					action = function()
						addOneOffSound(0, 0, 0, SOUND_CLICK)
						camHack.ignoreSomeObjects = not camHack.ignoreSomeObjects
					end,
					description = "Ignore some dynamic objects.~n~~h~Default: OFF."
				},
				{
					label = "Shoot Thru   " .. (camHack.allowShootThrough and "~g~~h~~h~~h~ON" or "~r~~h~~h~~h~OFF"),
					action = function()
						addOneOffSound(0, 0, 0, SOUND_CLICK)
						camHack.allowShootThrough = not camHack.allowShootThrough
					end,
					description = "Check collisions with shooting through objects.~n~~h~Default: OFF."
				},
				{
					label = "Reset to Default",
					action = function()
						local currentTime = socket.gettime()
						if currentTime - lastCHResetTime < 0.25 then
							printStringNow("~r~~h~~h~ CЂPOC HACЏPOEK", 900)
						end
						lastCHResetTime = currentTime
						addOneOffSound(0, 0, 0, SOUND_CONFIRM)
					end,
					description = "Reset all options to their default settings.~n~~h~Click twice to confirm."
				},
				{
					label = "",
					action = function()
					end,
					description = ""
				},
				{
					label = "Back",
					action = function()
						currentMenu = "OptionsMenu"
						focusIndex = 1
						addOneOffSound(0, 0, 0, SOUND_BACK)
					end,
					description = "Return to the Options Menu."
				}
			}
		}


        
    }
end


максимально отрефактори этот код (оставив совместимость с функциями его использующими )