forked from 7GrandDadPGN/VapeV4ForRoblox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
110 lines (102 loc) · 3.53 KB
/
main.lua
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
repeat task.wait() until game:IsLoaded()
if shared.vape then shared.vape:Uninject() end
local vape
local loadstring = function(...)
local res, err = loadstring(...)
if err and vape then
vape:CreateNotification('Vape', 'Failed to load : '..err, 30, 'alert')
end
return res
end
local queue_on_teleport = queue_on_teleport or function() end
local isfile = isfile or function(file)
local suc, res = pcall(function()
return readfile(file)
end)
return suc and res ~= nil and res ~= ''
end
local cloneref = cloneref or function(obj)
return obj
end
local playersService = cloneref(game:GetService('Players'))
local function downloadFile(path, func)
if not isfile(path) then
local suc, res = pcall(function()
return game:HttpGet('https://raw.githubusercontent.com/7GrandDadPGN/VapeV4ForRoblox/'..readfile('newvape/profiles/commit.txt')..'/'..select(1, path:gsub('newvape/', '')), true)
end)
if not suc or res == '404: Not Found' then
error(res)
end
if path:find('.lua') then
res = '--This watermark is used to delete the file if its cached, remove it to make the file persist after vape updates.\n'..res
end
writefile(path, res)
end
return (func or readfile)(path)
end
local function finishLoading()
vape.Init = nil
vape:Load()
task.spawn(function()
repeat
vape:Save()
task.wait(10)
until not vape.Loaded
end)
local teleportedServers
vape:Clean(playersService.LocalPlayer.OnTeleport:Connect(function()
if (not teleportedServers) and (not shared.VapeIndependent) then
teleportedServers = true
local teleportScript = [[
shared.vapereload = true
if shared.VapeDeveloper then
loadstring(readfile('newvape/loader.lua'), 'loader')()
else
loadstring(game:HttpGet('https://raw.githubusercontent.com/7GrandDadPGN/VapeV4ForRoblox/'..readfile('newvape/profiles/commit.txt')..'/loader.lua', true), 'loader')()
end
]]
if shared.VapeDeveloper then
teleportScript = 'shared.VapeDeveloper = true\n'..teleportScript
end
if shared.VapeCustomProfile then
teleportScript = 'shared.VapeCustomProfile = "'..shared.VapeCustomProfile..'"\n'..teleportScript
end
vape:Save()
queue_on_teleport(teleportScript)
end
end))
if not shared.vapereload then
if not vape.Categories then return end
if vape.Categories.Main.Options['GUI bind indicator'].Enabled then
vape:CreateNotification('Finished Loading', vape.VapeButton and 'Press the button in the top right to open GUI' or 'Press '..table.concat(vape.Keybind, ' + '):upper()..' to open GUI', 5)
end
end
end
if not isfile('newvape/profiles/gui.txt') then
writefile('newvape/profiles/gui.txt', 'new')
end
local gui = readfile('newvape/profiles/gui.txt')
if not isfolder('newvape/assets/'..gui) then
makefolder('newvape/assets/'..gui)
end
vape = loadstring(downloadFile('newvape/guis/'..gui..'.lua'), 'gui')()
shared.vape = vape
if not shared.VapeIndependent then
loadstring(downloadFile('newvape/games/universal.lua'), 'universal')()
if isfile('newvape/games/'..game.PlaceId..'.lua') then
loadstring(readfile('newvape/games/'..game.PlaceId..'.lua'), tostring(game.PlaceId))(...)
else
if not shared.VapeDeveloper then
local suc, res = pcall(function()
return game:HttpGet('https://raw.githubusercontent.com/7GrandDadPGN/VapeV4ForRoblox/'..readfile('newvape/profiles/commit.txt')..'/games/'..game.PlaceId..'.lua', true)
end)
if suc and res ~= '404: Not Found' then
loadstring(downloadFile('newvape/games/'..game.PlaceId..'.lua'), tostring(game.PlaceId))(...)
end
end
end
finishLoading()
else
vape.Init = finishLoading
return vape
end