Repository navigation
Expand file tree
/
Copy pathLauncher.lua
More file actions
252 lines (233 loc) · 7.59 KB
/
Copy pathLauncher.lua
File metadata and controls
252 lines (233 loc) · 7.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
-- VBL Script Launcher (Volleyball Legends)
-- Fetches the script list from the GitHub repo and runs the one you pick.
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local lp = Players.LocalPlayer
local pg = lp:WaitForChild("PlayerGui")
local REPO = "Nade-is-not-a-dev/vbl-scripts"
local API_URL = "https://api.github.com/repos/" .. REPO .. "/contents/"
local COMMIT_URL = "https://api.github.com/repos/" .. REPO .. "/commits/main"
local RAW_URL = "https://raw.githubusercontent.com/" .. REPO .. "/main/"
-- ---------- deep logging ----------
local LOG_PATH = "Launcher_log.txt"
local logbuf = {}
local function now()
local ok, s = pcall(os.date, "%H:%M:%S")
return ok and s or tostring(os.time())
end
local function log(msg)
table.insert(logbuf, "[" .. now() .. "] " .. tostring(msg))
if #logbuf > 300 then table.remove(logbuf, 1) end
pcall(writefile, LOG_PATH, table.concat(logbuf, "\n"))
end
local function logError(msg)
log("!! ERROR: " .. tostring(msg))
pcall(writefile, LOG_PATH, table.concat(logbuf, "\n"))
end
log("=== Launcher started ===")
log("executor: " .. tostring(identifyexecutor and identifyexecutor() or "unknown"))
log("game: " .. tostring(game.PlaceId) .. " | joined: " .. tostring(os.time()))
local function fetch(url)
if request then
local ok, res = pcall(request, {
Url = url,
Method = "GET",
Headers = { ["User-Agent"] = "Mozilla/5.0" },
})
if ok and res then
if type(res) == "table" and res.Body then
return res.Body
end
if type(res) == "string" then
return res
end
end
end
local ok2, res2 = pcall(HttpService.GetAsync, HttpService, url)
if ok2 and type(res2) == "string" then
return res2
end
return nil
end
local function getScripts()
local json = fetch(API_URL)
if not json then
log("list fetch FAILED (no body)")
return nil
end
local ok, data = pcall(HttpService.JSONDecode, HttpService, json)
if not ok or type(data) ~= "table" then
logError("list JSON decode failed: " .. tostring(ok and "bad type" or data))
return nil
end
local list = {}
for _, item in ipairs(data) do
if type(item) == "table" and item.type == "file" and item.name:sub(-4) == ".lua"
and item.name ~= "Launcher.lua"
and item.name ~= "gui_framework.lua"
and item.name ~= "framework_v3.lua" then
table.insert(list, item.name)
end
end
table.sort(list)
log("list fetch OK: " .. #list .. " scripts")
return list
end
local function getLastCommit()
local json = fetch(COMMIT_URL)
if not json then
log("commit fetch FAILED (no body)")
return nil
end
local ok, data = pcall(HttpService.JSONDecode, HttpService, json)
if not ok or type(data) ~= "table" then
logError("commit JSON decode failed")
return nil
end
local sha = data.sha or (data.commit and data.commit.sha)
if sha then
local short = tostring(sha):sub(1, 7)
log("last commit on main: " .. short)
return short
end
logError("commit response has no sha")
return nil
end
local function killOldGuis()
local guiNames = { "JerseyChanger", "BallSkinChanger", "PlayerCardSpoofer", "EmoteSpoof" }
for _, n in ipairs(guiNames) do
local g = lp.PlayerGui:FindFirstChild(n)
if g and g:IsA("ScreenGui") then
g:Destroy()
end
end
end
local function runScript(name)
log("RUN " .. name .. " ...")
killOldGuis()
local code = fetch(RAW_URL .. name .. "?cb=" .. tostring(os.time()))
if not code then
logError("RUN " .. name .. " failed: fetch returned nil")
return false
end
log("RUN " .. name .. ": fetched " .. tostring(#code) .. " chars")
local fn, err = loadstring(code)
if not fn then
logError("RUN " .. name .. " parse error: " .. tostring(err))
warn("Launcher: parse error in " .. name .. ": " .. tostring(err))
return false
end
local ok, perr = xpcall(fn, function(e)
return debug.traceback(tostring(e), 2)
end)
if not ok then
logError("RUN " .. name .. " runtime error:\n" .. tostring(perr))
warn("Launcher: runtime error in " .. name .. "\n" .. tostring(perr))
return false
end
log("RUN " .. name .. " finished OK")
return true
end
-- ---------- GUI framework (fetched from repo) ----------
local _fw = fetch(RAW_URL .. "framework_v3.lua?cb=" .. tostring(os.time()))
if _fw then
log("framework fetched: " .. tostring(#_fw) .. " chars")
else
logError("framework fetch FAILED")
end
local GUI = _fw and loadstring(_fw)()
if not GUI then
logError("framework loadstring failed")
end
assert(GUI, "Failed to load GUI framework - check connection")
-- ---------- GUI (framework) ----------
local win = GUI.Window({
title = "VBL Script Launcher",
name = "VBLLauncher",
icon = "VL",
size = Vector2.new(280, 240),
y = 30,
})
local frame = win.Content
-- t6: margins konsisten 12px; spinner + refresh hover + scrollbar token
local status = GUI.Label(frame, "Loading script list...", UDim2.new(0, 12, 0, 12), UDim2.new(1, -48, 0, 16))
local spinner = GUI.Spinner(frame, { position = UDim2.new(1, -30, 0, 11), size = UDim2.fromOffset(18, 18) })
local refreshBtn = GUI.Button(frame, "REFRESH", UDim2.new(0, 12, 0, 32), UDim2.new(0, 110, 0, 24))
-- t6: hover feedback eksplisit (defensive bila framework di repo belum v1.1.0)
local refreshBase = refreshBtn.BackgroundColor3
refreshBtn.MouseEnter:Connect(function()
pcall(GUI.Animate, refreshBtn, { BackgroundColor3 = GUI.hoverColor(refreshBase) }, 0.1)
end)
refreshBtn.MouseLeave:Connect(function()
pcall(GUI.Animate, refreshBtn, { BackgroundColor3 = refreshBase }, 0.1)
end)
local commitLabel = GUI.Label(frame, "commit: ?", UDim2.new(0, 12, 1, -26), UDim2.new(1, -24, 0, 14),
{ color = GUI.Theme.warn, textSize = 9 })
local listFrame = Instance.new("ScrollingFrame")
listFrame.Size = UDim2.new(1, -24, 0, 118)
listFrame.Position = UDim2.new(0, 12, 0, 60)
listFrame.BackgroundColor3 = GUI.Theme.input
listFrame.BorderSizePixel = 0
listFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
listFrame.ScrollBarThickness = 4
listFrame.ScrollBarImageColor3 = GUI.Theme.hover
listFrame.AutomaticCanvasSize = Enum.AutomaticSize.Y
listFrame.Parent = frame
local listCorner = Instance.new("UICorner")
listCorner.CornerRadius = UDim.new(0, 6)
listCorner.Parent = listFrame
local function addScriptButton(name, index)
local b = GUI.Button(listFrame, name:gsub("%.lua$", ""),
UDim2.new(0, 6, 0, (index - 1) * 30), UDim2.new(1, -12, 0, 26))
b.MouseButton1Click:Connect(function()
status.Text = "Running " .. name .. "..."
local ok = runScript(name)
if ok then
status.Text = "Started: " .. name
GUI.Notify("Started: " .. name, "success")
else
status.Text = "Failed: " .. name .. " (see console)"
GUI.Notify("Failed to run: " .. name, "error")
end
end)
end
local function renderList()
for _, child in ipairs(listFrame:GetChildren()) do
if child:IsA("TextButton") then
child:Destroy()
end
end
local list = getScripts()
if not list then
status.Text = "Failed to fetch repo list"
GUI.Notify("Failed to fetch repo list", "error")
return
end
for i, name in ipairs(list) do
addScriptButton(name, i)
end
status.Text = "Scripts: " .. #list
end
-- t6: spinner START sebelum memuat list, STOP saat selesai (success/error)
-- guard spinner ganda: GUI.Spinner.Start menolak bila sudah running
local function loadList()
pcall(spinner.Start)
log("list loading started (spinner on)")
local ok, err = pcall(renderList)
pcall(spinner.Stop)
if ok then
log("list loading finished (spinner off)")
else
logError("list render failed: " .. tostring(err))
end
end
refreshBtn.MouseButton1Click:Connect(loadList)
loadList()
task.spawn(function()
local sha = getLastCommit()
if sha and commitLabel then
commitLabel.Text = "commit: " .. sha
status.Text = status.Text .. " | v" .. sha
end
end)