I must sleep

This commit is contained in:
cirroskais 2023-08-28 00:35:32 -04:00
parent 7c5cc4b27b
commit a915bd775c
No known key found for this signature in database
GPG Key ID: E55435DEA0825091
3 changed files with 7 additions and 46 deletions

View File

@ -137,12 +137,6 @@ class RenderJob extends Job {
}
async RenderPlace(id) {
const response = await axios(`${process.env.BASE_URL}/API/Game/${id}?t=${process.env.ARBITER_TOKEN}`).catch((_) => reject(_))
const { server_token } = response.data
this.serverToken = server_token
console.log(`${process.env.BASE_URL}/API/Game/${id}?t=${process.env.ARBITER_TOKEN}`, server_token)
const running = this.started
if (!running) {
const started = await this.Start()
@ -168,7 +162,7 @@ class RenderJob extends Job {
{ type: "LUA_TSTRING", value: process.env.BASE_URL },
{ type: "LUA_TNUMBER", value: id },
{ type: "LUA_TSTRING", value: this.serverToken },
{ type: "LUA_TSTRING", value: "test" },
],
},
}).catch((e) => false)

View File

@ -12,39 +12,6 @@ function waitForChild(parent, childName)
end
end
function update(LeavingPlayer)
local names = {}
for _, player in pairs(game:GetService("Players"):GetPlayers()) do
if (player ~= LeavingPlayer) then
table.insert(names, player.Name)
end
end
local str = (#names > 0) and (#names > 1) and (names[1] .. ",") or names[1] or ""
for i = 2, #names -1, 1 do
str = str .. names[i] .. ","
end
str = (#names > 0) and (#names > 1) and (str .. names[#names]) or names[1] or ""
return str
end
function keepAlive(LeavingPlayer)
pcall(function()
game:GetService("HttpService").HttpEnabled = true
local body = game:GetService("HttpService"):JSONEncode({
["ServerIP"] = jobId,
["PlaceId"] = game.PlaceId,
["PlayerCount"] = #game:GetService("Players"):GetPlayers(),
["PlayerList"] = update(LeavingPlayer),
})
return game:GetService("HttpService"):PostAsync("https://dungblx.cf/API/KeepAlive", body)
end)
end
-----------------------------------END UTILITY FUNCTIONS -------------------------
-----------------------------------"CUSTOM" SHARED CODE----------------------------------
@ -106,7 +73,7 @@ end)
if placeId~=nil and baseUrl~=nil then
wait()
game:Load("https://kapish.fun/asset/?id=" .. placeId .. "&placelol=true&key=" .. key)
game:Load("https://kapish.fun/asset/?id=" .. placeId .. "&placelol=true")
end
-- Now start the connection
@ -127,16 +94,16 @@ spawn(function()
end
end
pcall(function() game:HttpGet('http://kapish.fun/server/ping/' .. placeId .. '?players=' .. playerIds .. "&key=" .. key) end)
pcall(function() game:HttpGet('http://kapish.fun/server/ping/' .. placeId .. '?players=' .. playerIds) end)
end
end)
spawn(function()
while wait(60) do
if #game.Players:GetPlayers() == 0 then
pcall(function() game:HttpGet("https://kapish.fun/dielol/" .. placeId.."?key=" .. key) end)
pcall(function() game:HttpGet("https://kapish.fun/dielol/" .. placeId) end)
else
pcall(function() game:HttpGet("https://kapish.fun/renewlol/" .. placeId.."?key=" .. key) end)
pcall(function() game:HttpGet("https://kapish.fun/renewlol/" .. placeId) end)
end
end
end)

View File

@ -1,4 +1,4 @@
local jobId, type, format, x, y, baseUrl, assetId, key = ...
local jobId, type, format, x, y, baseUrl, assetId = ...
print(("[%s] Started RenderJob for type '%s' with assetId %d ..."):format(jobId, type, assetId))
@ -11,7 +11,7 @@ game:GetService("ContentProvider"):SetBaseUrl(baseUrl)
game:GetService("ScriptContext").ScriptsDisabled = true
game:GetService("StarterGui").ShowDevelopmentGui = false
game:Load(("%s//asset/?id=%d&placelol=true&key=%s"):format(baseUrl, assetId, key))
game:Load(("%s/asset/?id=%d&placelol=true"):format(baseUrl, assetId))
game:GetService("ScriptContext").ScriptsDisabled = true
game:GetService("StarterGui").ShowDevelopmentGui = false