ui.setAsynchronousImagesLoading(true) -- Configuración inicial y variables globales local settings = { autopilot = {enabled = true, Speed = 150, Agression = 160, Pitnow = false}, initialized = false, timerStarted = false, timer = 0 } settings.timerStarted = true settings.timer = 0 -- Función callback para cuando comienza una nueva sesión o se reinicia local function onSessionStart(sessionIndex, restarted) if restarted then -- Si la sesión se ha reiniciado, ejecutar shutdown ac.shutdownAssettoCorsa() end end -- Establecer el callback de inicio de sesión ac.onSessionStart(onSessionStart) function script.update(dt) -- Actualización del temporizador if settings.timerStarted then settings.timer = settings.timer + dt end -- Configurar IA después de 15 segundos desde el inicio de la carrera if settings.timerStarted and settings.timer > 15 and not settings.initialized then settings.initialized = true settings.autopilot.Speed = 100 -- Configura el nivel de IA al 5% settings.autopilot.enabled = true -- Asegúrate de que el autopiloto esté habilitado settings.autopilot.Agression = 50 for i = 1, 23 do -- Itera sobre todos los coches physics.setAILevel(i, settings.autopilot.Speed / 100) physics.setAIAggression(i, settings.autopilot.Agression / 100) end end -- Aquí puedes poner cualquier otro código que necesites ejecutar en cada frame end function script.windowMain(dt) local car = ac.getCar(0) local carspeed = ac.getCarSpeedKmh(car) -- Puedes agregar más código aquí si lo necesitas end