Nevzyn

Untitled

Oct 19th, 2025
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.66 KB | None | 0 0
  1. --[[
  2. ╔═══════════════════════════════════════════════════════════╗
  3. ║ SISTEMA UNIFICADO DE SCRIPTS v1.0.0 ║
  4. ║ Gerenciador Multi-Script Robusto ║
  5. ║ By: NickZScripts ║
  6. ╚═══════════════════════════════════════════════════════════╝
  7.  
  8. 📋 Scripts Carregados:
  9. 1️⃣ https://pastebin.com/raw/PUN7TTtj
  10. 2️⃣ https://pastebin.com/raw/U1qgKfw6
  11. 3️⃣ https://pastebin.com/raw/hvRNk6ak
  12.  
  13. ✅ Sistema Anti-Conflitos
  14. ✅ Ambientes Isolados
  15. ✅ Gerenciamento de Erros
  16. ✅ Logs Detalhados
  17. ]]
  18.  
  19. --// ========== SERVICES ========== //
  20. local HttpService = game:GetService("HttpService")
  21. local Players = game:GetService("Players")
  22. local RunService = game:GetService("RunService")
  23.  
  24. --// ========== CONFIGURAÇÕES ========== //
  25. local LocalPlayer = Players.LocalPlayer
  26. local SYSTEM_VERSION = "1.0.0"
  27.  
  28. --// ========== LISTA DE SCRIPTS ========== //
  29. local ScriptList = {
  30. {
  31. Name = "Script 1 - PUN7TTtj",
  32. URL = "https://pastebin.com/raw/PUN7TTtj",
  33. Priority = 1,
  34. Enabled = true,
  35. LoadTimeout = 10,
  36. RetryAttempts = 3,
  37. },
  38. {
  39. Name = "Script 2 - U1qgKfw6",
  40. URL = "https://pastebin.com/raw/U1qgKfw6",
  41. Priority = 2,
  42. Enabled = true,
  43. LoadTimeout = 10,
  44. RetryAttempts = 3,
  45. },
  46. {
  47. Name = "Script 3 - hvRNk6ak",
  48. URL = "https://pastebin.com/raw/hvRNk6ak",
  49. Priority = 3,
  50. Enabled = true,
  51. LoadTimeout = 10,
  52. RetryAttempts = 3,
  53. },
  54. }
  55.  
  56. --// ========== SISTEMA DE LOGS AVANÇADO ========== //
  57. local Logger = (function()
  58. local logs = {}
  59. local maxLogs = 1000
  60.  
  61. local colors = {
  62. INFO = "\27[36m", -- Cyan
  63. SUCCESS = "\27[32m", -- Green
  64. WARNING = "\27[33m", -- Yellow
  65. ERROR = "\27[31m", -- Red
  66. DEBUG = "\27[35m", -- Magenta
  67. RESET = "\27[0m"
  68. }
  69.  
  70. local function getTimestamp()
  71. return os.date("%H:%M:%S")
  72. end
  73.  
  74. local function log(level, message, scriptName)
  75. local timestamp = getTimestamp()
  76. local prefix = scriptName and ("[" .. scriptName .. "] ") or ""
  77. local fullMessage = string.format("[%s] %s%s%s", timestamp, prefix, level, message)
  78.  
  79. table.insert(logs, {
  80. timestamp = timestamp,
  81. level = level,
  82. message = message,
  83. scriptName = scriptName,
  84. fullMessage = fullMessage
  85. })
  86.  
  87. if #logs > maxLogs then
  88. table.remove(logs, 1)
  89. end
  90.  
  91. local color = colors[level] or colors.RESET
  92. print(color .. fullMessage .. colors.RESET)
  93. end
  94.  
  95. return {
  96. Info = function(msg, script) log("INFO", msg, script) end,
  97. Success = function(msg, script) log("SUCCESS", msg, script) end,
  98. Warning = function(msg, script) log("WARNING", msg, script) end,
  99. Error = function(msg, script) log("ERROR", msg, script) end,
  100. Debug = function(msg, script) log("DEBUG", msg, script) end,
  101. GetLogs = function() return logs end,
  102. Clear = function() logs = {} end
  103. }
  104. end)()
  105.  
  106. --// ========== SISTEMA DE DOWNLOAD ROBUSTO ========== //
  107. local Downloader = (function()
  108. local cache = {}
  109.  
  110. local function downloadWithRetry(url, maxAttempts, timeout)
  111. maxAttempts = maxAttempts or 3
  112. timeout = timeout or 10
  113.  
  114. for attempt = 1, maxAttempts do
  115. local success, result = pcall(function()
  116. Logger.Debug("Tentativa " .. attempt .. "/" .. maxAttempts .. " de download: " .. url)
  117.  
  118. local startTime = tick()
  119. local scriptContent = game:HttpGet(url)
  120. local downloadTime = tick() - startTime
  121.  
  122. if not scriptContent or scriptContent == "" then
  123. error("Conteúdo vazio recebido")
  124. end
  125.  
  126. Logger.Success(string.format("Download completo em %.2fs (%d bytes)", downloadTime, #scriptContent))
  127.  
  128. return scriptContent
  129. end)
  130.  
  131. if success then
  132. cache[url] = result
  133. return true, result
  134. else
  135. Logger.Warning("Tentativa " .. attempt .. " falhou: " .. tostring(result))
  136.  
  137. if attempt < maxAttempts then
  138. local waitTime = attempt * 2
  139. Logger.Info("Aguardando " .. waitTime .. "s antes de tentar novamente...")
  140. task.wait(waitTime)
  141. end
  142. end
  143. end
  144.  
  145. return false, "Falha após " .. maxAttempts .. " tentativas"
  146. end
  147.  
  148. return {
  149. Download = downloadWithRetry,
  150. GetCache = function() return cache end,
  151. ClearCache = function() cache = {} end
  152. }
  153. end)()
  154.  
  155. --// ========== SISTEMA DE AMBIENTE ISOLADO ========== //
  156. local EnvironmentManager = (function()
  157. local environments = {}
  158.  
  159. local function createIsolatedEnvironment(scriptName)
  160. local env = {}
  161.  
  162. -- Copia ambiente global de forma segura
  163. for k, v in pairs(getfenv()) do
  164. env[k] = v
  165. end
  166.  
  167. -- Serviços importantes
  168. env.game = game
  169. env.workspace = workspace
  170. env.Game = game
  171. env.Workspace = workspace
  172.  
  173. -- Funções essenciais
  174. env.print = function(...)
  175. Logger.Info(table.concat({...}, " "), scriptName)
  176. end
  177.  
  178. env.warn = function(...)
  179. Logger.Warning(table.concat({...}, " "), scriptName)
  180. end
  181.  
  182. env.error = function(...)
  183. Logger.Error(table.concat({...}, " "), scriptName)
  184. end
  185.  
  186. -- Namespace único para cada script
  187. env._SCRIPT_NAME = scriptName
  188. env._SCRIPT_ENV = env
  189.  
  190. -- Previne conflitos globais
  191. env.getgenv = function()
  192. return env
  193. end
  194.  
  195. env.getfenv = function()
  196. return env
  197. end
  198.  
  199. -- Armazena ambiente
  200. environments[scriptName] = env
  201.  
  202. Logger.Debug("Ambiente isolado criado para: " .. scriptName)
  203.  
  204. return env
  205. end
  206.  
  207. return {
  208. Create = createIsolatedEnvironment,
  209. Get = function(name) return environments[name] end,
  210. GetAll = function() return environments end
  211. }
  212. end)()
  213.  
  214. --// ========== GERENCIADOR DE SCRIPTS ========== //
  215. local ScriptManager = (function()
  216. local loadedScripts = {}
  217. local failedScripts = {}
  218.  
  219. local function loadScript(scriptInfo)
  220. Logger.Info("════════════════════════════════════════")
  221. Logger.Info("Carregando: " .. scriptInfo.Name)
  222. Logger.Info("URL: " .. scriptInfo.URL)
  223. Logger.Info("Prioridade: " .. scriptInfo.Priority)
  224. Logger.Info("════════════════════════════════════════")
  225.  
  226. -- Download do script
  227. local downloadSuccess, scriptContent = Downloader.Download(
  228. scriptInfo.URL,
  229. scriptInfo.RetryAttempts,
  230. scriptInfo.LoadTimeout
  231. )
  232.  
  233. if not downloadSuccess then
  234. Logger.Error("Falha no download: " .. tostring(scriptContent), scriptInfo.Name)
  235. table.insert(failedScripts, {
  236. info = scriptInfo,
  237. reason = scriptContent,
  238. timestamp = tick()
  239. })
  240. return false
  241. end
  242.  
  243. -- Cria ambiente isolado
  244. local env = EnvironmentManager.Create(scriptInfo.Name)
  245.  
  246. -- Compila o script
  247. local compileSuccess, compiledFunction = pcall(function()
  248. return loadstring(scriptContent)
  249. end)
  250.  
  251. if not compileSuccess then
  252. Logger.Error("Erro na compilação: " .. tostring(compiledFunction), scriptInfo.Name)
  253. table.insert(failedScripts, {
  254. info = scriptInfo,
  255. reason = "Compilation error: " .. tostring(compiledFunction),
  256. timestamp = tick()
  257. })
  258. return false
  259. end
  260.  
  261. -- Define ambiente
  262. setfenv(compiledFunction, env)
  263.  
  264. -- Executa o script com proteção
  265. local executeSuccess, executeResult = pcall(function()
  266. return compiledFunction()
  267. end)
  268.  
  269. if not executeSuccess then
  270. Logger.Error("Erro na execução: " .. tostring(executeResult), scriptInfo.Name)
  271. table.insert(failedScripts, {
  272. info = scriptInfo,
  273. reason = "Execution error: " .. tostring(executeResult),
  274. timestamp = tick()
  275. })
  276. return false
  277. end
  278.  
  279. -- Script carregado com sucesso
  280. table.insert(loadedScripts, {
  281. info = scriptInfo,
  282. env = env,
  283. result = executeResult,
  284. loadedAt = tick()
  285. })
  286.  
  287. Logger.Success("✅ " .. scriptInfo.Name .. " carregado com sucesso!")
  288. Logger.Info("════════════════════════════════════════\n")
  289.  
  290. return true
  291. end
  292.  
  293. local function loadAll()
  294. Logger.Info("╔════════════════════════════════════════╗")
  295. Logger.Info("║ INICIANDO SISTEMA UNIFICADO v" .. SYSTEM_VERSION .. " ║")
  296. Logger.Info("╚════════════════════════════════════════╝\n")
  297.  
  298. -- Ordena por prioridade
  299. table.sort(ScriptList, function(a, b)
  300. return a.Priority < b.Priority
  301. end)
  302.  
  303. local totalScripts = 0
  304. local successCount = 0
  305. local failCount = 0
  306.  
  307. for i, scriptInfo in ipairs(ScriptList) do
  308. if scriptInfo.Enabled then
  309. totalScripts = totalScripts + 1
  310.  
  311. Logger.Info("📥 Carregando script " .. i .. "/" .. #ScriptList)
  312.  
  313. local success = loadScript(scriptInfo)
  314.  
  315. if success then
  316. successCount = successCount + 1
  317. else
  318. failCount = failCount + 1
  319. end
  320.  
  321. -- Pequeno delay entre scripts para evitar sobrecarga
  322. if i < #ScriptList then
  323. task.wait(0.5)
  324. end
  325. else
  326. Logger.Warning("Script desabilitado: " .. scriptInfo.Name)
  327. end
  328. end
  329.  
  330. -- Relatório final
  331. Logger.Info("\n╔════════════════════════════════════════╗")
  332. Logger.Info("║ RELATÓRIO DE CARREGAMENTO ║")
  333. Logger.Info("╠════════════════════════════════════════╣")
  334. Logger.Info("║ Total de Scripts: " .. totalScripts)
  335. Logger.Success("║ ✅ Carregados: " .. successCount)
  336. if failCount > 0 then
  337. Logger.Error("║ ❌ Falharam: " .. failCount)
  338. end
  339. Logger.Info("╚════════════════════════════════════════╝\n")
  340.  
  341. -- Detalhes dos scripts carregados
  342. if #loadedScripts > 0 then
  343. Logger.Success("Scripts carregados com sucesso:")
  344. for i, data in ipairs(loadedScripts) do
  345. Logger.Success(" " .. i .. ". " .. data.info.Name)
  346. end
  347. print("")
  348. end
  349.  
  350. -- Detalhes dos scripts que falharam
  351. if #failedScripts > 0 then
  352. Logger.Error("Scripts que falharam:")
  353. for i, data in ipairs(failedScripts) do
  354. Logger.Error(" " .. i .. ". " .. data.info.Name)
  355. Logger.Error(" Motivo: " .. data.reason)
  356. end
  357. print("")
  358. end
  359.  
  360. return {
  361. total = totalScripts,
  362. success = successCount,
  363. failed = failCount,
  364. loadedScripts = loadedScripts,
  365. failedScripts = failedScripts
  366. }
  367. end
  368.  
  369. return {
  370. LoadAll = loadAll,
  371. GetLoaded = function() return loadedScripts end,
  372. GetFailed = function() return failedScripts end
  373. }
  374. end)()
  375.  
  376. --// ========== SISTEMA DE MONITORAMENTO ========== //
  377. local Monitor = (function()
  378. local monitoring = false
  379. local stats = {
  380. startTime = tick(),
  381. errors = 0,
  382. warnings = 0,
  383. }
  384.  
  385. local function start()
  386. if monitoring then return end
  387. monitoring = true
  388.  
  389. Logger.Info("🔍 Monitor de sistema iniciado")
  390.  
  391. -- Monitor de performance
  392. task.spawn(function()
  393. while monitoring do
  394. task.wait(10)
  395.  
  396. local memoryUsage = gcinfo()
  397. local uptime = tick() - stats.startTime
  398.  
  399. Logger.Debug(string.format(
  400. "Status: Uptime %.0fs | Memória: %.2f MB",
  401. uptime,
  402. memoryUsage / 1024
  403. ))
  404. end
  405. end)
  406. end
  407.  
  408. local function stop()
  409. monitoring = false
  410. Logger.Info("🔍 Monitor de sistema parado")
  411. end
  412.  
  413. local function getStats()
  414. return {
  415. uptime = tick() - stats.startTime,
  416. memory = gcinfo() / 1024,
  417. errors = stats.errors,
  418. warnings = stats.warnings
  419. }
  420. end
  421.  
  422. return {
  423. Start = start,
  424. Stop = stop,
  425. GetStats = getStats
  426. }
  427. end)()
  428.  
  429. --// ========== SISTEMA DE VERIFICAÇÃO DE SAÚDE ========== //
  430. local HealthCheck = (function()
  431. local function checkEnvironment()
  432. local checks = {
  433. {name = "HttpService", test = function() return game:GetService("HttpService") end},
  434. {name = "Players", test = function() return game:GetService("Players") end},
  435. {name = "LocalPlayer", test = function() return Players.LocalPlayer end},
  436. {name = "HttpGet", test = function() return type(game.HttpGet) == "function" end},
  437. {name = "loadstring", test = function() return type(loadstring) == "function" end},
  438. }
  439.  
  440. local allPassed = true
  441.  
  442. Logger.Info("🔍 Verificando ambiente de execução...")
  443.  
  444. for _, check in ipairs(checks) do
  445. local success, result = pcall(check.test)
  446. if success and result then
  447. Logger.Success(" ✅ " .. check.name)
  448. else
  449. Logger.Error(" ❌ " .. check.name)
  450. allPassed = false
  451. end
  452. end
  453.  
  454. return allPassed
  455. end
  456.  
  457. return {
  458. CheckEnvironment = checkEnvironment
  459. }
  460. end)()
  461.  
  462. --// ========== SISTEMA DE RECUPERAÇÃO DE ERROS ========== //
  463. local ErrorRecovery = (function()
  464. local function handleCriticalError(err, scriptName)
  465. Logger.Error("╔════════════════════════════════════════╗")
  466. Logger.Error("║ ERRO CRÍTICO DETECTADO ║")
  467. Logger.Error("╠════════════════════════════════════════╣")
  468. if scriptName then
  469. Logger.Error("║ Script: " .. scriptName)
  470. end
  471. Logger.Error("║ Erro: " .. tostring(err))
  472. Logger.Error("╚════════════════════════════════════════╝")
  473.  
  474. -- Tenta recuperação
  475. Logger.Warning("Tentando recuperar...")
  476.  
  477. task.wait(2)
  478.  
  479. Logger.Info("Sistema continua operacional")
  480. end
  481.  
  482. return {
  483. Handle = handleCriticalError
  484. }
  485. end)()
  486.  
  487. --// ========== INTERFACE DE CONTROLE (OPCIONAL) ========== //
  488. local ControlInterface = (function()
  489. local function createSimpleUI()
  490. -- Cria uma UI simples para controle
  491. local screenGui = Instance.new("ScreenGui")
  492. screenGui.Name = "UnifiedScriptManager"
  493. screenGui.ResetOnSpawn = false
  494. screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  495.  
  496. pcall(function()
  497. screenGui.Parent = game:GetService("CoreGui")
  498. end)
  499.  
  500. if not screenGui.Parent then
  501. screenGui.Parent = LocalPlayer:WaitForChild("PlayerGui")
  502. end
  503.  
  504. -- Frame principal (minimizado no canto)
  505. local mainFrame = Instance.new("Frame")
  506. mainFrame.Size = UDim2.new(0, 200, 0, 40)
  507. mainFrame.Position = UDim2.new(1, -210, 0, 10)
  508. mainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 40)
  509. mainFrame.BackgroundTransparency = 0.1
  510. mainFrame.BorderSizePixel = 0
  511. mainFrame.Active = true
  512. mainFrame.Draggable = true
  513. mainFrame.Parent = screenGui
  514.  
  515. local corner = Instance.new("UICorner")
  516. corner.CornerRadius = UDim.new(0, 8)
  517. corner.Parent = mainFrame
  518.  
  519. -- Label de status
  520. local statusLabel = Instance.new("TextLabel")
  521. statusLabel.Size = UDim2.new(1, -10, 1, -10)
  522. statusLabel.Position = UDim2.new(0, 5, 0, 5)
  523. statusLabel.BackgroundTransparency = 1
  524. statusLabel.Text = "🔗 Sistema Unificado v" .. SYSTEM_VERSION
  525. statusLabel.TextColor3 = Color3.fromRGB(100, 255, 100)
  526. statusLabel.TextSize = 14
  527. statusLabel.Font = Enum.Font.GothamBold
  528. statusLabel.TextXAlignment = Enum.TextXAlignment.Left
  529. statusLabel.Parent = mainFrame
  530.  
  531. Logger.Success("Interface de controle criada")
  532.  
  533. return screenGui
  534. end
  535.  
  536. return {
  537. Create = createSimpleUI
  538. }
  539. end)()
  540.  
  541. --// ========== EXECUÇÃO PRINCIPAL ========== //
  542. local function main()
  543. -- Banner de inicialização
  544. print("\n" .. string.rep("=", 60))
  545. print(" 🔗 SISTEMA UNIFICADO DE SCRIPTS v" .. SYSTEM_VERSION)
  546. print(" By: NickZScripts")
  547. print(" Jogador: " .. LocalPlayer.Name)
  548. print(string.rep("=", 60) .. "\n")
  549.  
  550. -- Verificação de saúde do ambiente
  551. if not HealthCheck.CheckEnvironment() then
  552. Logger.Error("⚠️ Ambiente não está pronto! Alguns recursos podem não funcionar.")
  553. task.wait(2)
  554. end
  555.  
  556. -- Inicia monitor
  557. Monitor.Start()
  558.  
  559. -- Cria interface (opcional)
  560. pcall(function()
  561. ControlInterface.Create()
  562. end)
  563.  
  564. -- Carrega todos os scripts
  565. local result = ScriptManager.LoadAll()
  566.  
  567. -- Verifica se pelo menos um script foi carregado
  568. if result.success > 0 then
  569. Logger.Success("╔════════════════════════════════════════╗")
  570. Logger.Success("║ SISTEMA OPERACIONAL! ✅ ║")
  571. Logger.Success("╚════════════════════════════════════════╝")
  572. else
  573. Logger.Error("╔════════════════════════════════════════╗")
  574. Logger.Error("║ NENHUM SCRIPT CARREGADO! ❌ ║")
  575. Logger.Error("╚════════════════════════════════════════╝")
  576. end
  577.  
  578. -- Estatísticas finais
  579. task.wait(1)
  580. local stats = Monitor.GetStats()
  581. Logger.Info("\n📊 Estatísticas do Sistema:")
  582. Logger.Info(string.format(" Uptime: %.1fs", stats.uptime))
  583. Logger.Info(string.format(" Memória: %.2f MB", stats.memory))
  584. Logger.Info(string.format(" Scripts Ativos: %d", result.success))
  585. end
  586.  
  587. --// ========== PROTEÇÃO CONTRA ERROS CRÍTICOS ========== //
  588. local mainSuccess, mainError = pcall(main)
  589.  
  590. if not mainSuccess then
  591. ErrorRecovery.Handle(mainError)
  592.  
  593. warn("\n╔════════════════════════════════════════╗")
  594. warn("║ FALHA CRÍTICA NO SISTEMA! ║")
  595. warn("╠════════════════════════════════════════╣")
  596. warn("║ Erro: " .. tostring(mainError))
  597. warn("╚════════════════════════════════════════╝\n")
  598. else
  599. print("\n✅ Sistema inicializado com sucesso!\n")
  600. end
  601.  
  602. --// ========== LIMPEZA AO SAIR ========== //
  603. game:GetService("Players").LocalPlayer.CharacterRemoving:Connect(function()
  604. Logger.Info("🧹 Limpando sistema...")
  605. Monitor.Stop()
  606. Downloader.ClearCache()
  607. end)
  608.  
  609. --// ========== API GLOBAL (OPCIONAL) ========== //
  610. getgenv().UnifiedScriptManager = {
  611. Version = SYSTEM_VERSION,
  612. Logger = Logger,
  613. ScriptManager = ScriptManager,
  614. Monitor = Monitor,
  615. Reload = function()
  616. Logger.Warning("Recarregando sistema...")
  617. task.wait(1)
  618. main()
  619. end,
  620. GetStats = function()
  621. return {
  622. monitor = Monitor.GetStats(),
  623. loaded = ScriptManager.GetLoaded(),
  624. failed = ScriptManager.GetFailed()
  625. }
  626. end
  627. }
  628.  
  629. print([[
  630.  
  631. ╔═══════════════════════════════════════════════════════════╗
  632. ║ SISTEMA PRONTO! ✅ ║
  633. ║ ║
  634. ║ Use: getgenv().UnifiedScriptManager ║
  635. ║ ║
  636. ║ Funções disponíveis: ║
  637. ║ • UnifiedScriptManager.Reload() ║
  638. ║ • UnifiedScriptManager.GetStats() ║
  639. ║ • UnifiedScriptManager.Logger.Info("msg") ║
  640. ╚═══════════════════════════════════════════════════════════╝
  641.  
  642. ]])
Advertisement
Add Comment
Please, Sign In to add comment