NO WAY MARIO UPDATES

This commit is contained in:
Mario 2023-05-22 13:19:37 +03:00 committed by GitHub
parent 0f6a6918c1
commit df96461ca0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 237 additions and 132 deletions

View File

@ -1,7 +1,8 @@
<?php <?php
// im gonna break it down short for anyone
require_once '../core/config.php'; require_once '../core/config.php';
require_once '../core/classes.php'; require_once '../core/classes.php';
header('content-type:application/json'); header('content-type:application/json'); // set the content type to json so it LOOKS COOL!
$allstatus = [ $allstatus = [
1 => "0 or 1 is not an error - it is a sign that we should wait", 1 => "0 or 1 is not an error - it is a sign that we should wait",
2 => "Success", 2 => "Success",
@ -10,20 +11,22 @@ $allstatus = [
5 => "Game ended", 5 => "Game ended",
6 => "GAME_FULL", 6 => "GAME_FULL",
10 => "USER_LEFT" 10 => "USER_LEFT"
]; ]; // statuses for placelauncher
$token = $_GET["token"]; if(isset($_GET["token"])) {
$checkifuser = $con->prepare('SELECT COUNT(*) FROM tokens WHERE token=:token'); $token = $_GET["token"]; // get the token from the url like: ?token=
$checkifuser = $con->prepare('SELECT COUNT(*) FROM tokens WHERE token=:token'); // check if the token even exists
$checkifuser->bindParam(':token', $token); $checkifuser->bindParam(':token', $token);
$checkifuser->execute(); $checkifuser->execute();
$momentoftruth = $checkifuser->fetchColumn(); $momentoftruth = $checkifuser->fetchColumn();
if ($momentoftruth == 1) { if ($momentoftruth == 1) {
$status = '2'; $status = '2'; // its defined now!
$getstuff = $con->prepare('SELECT placeid FROM tokens WHERE token=:token'); $getstuff = $con->prepare('SELECT placeid FROM tokens WHERE token=:token'); // get the placeid
$getstuff->bindParam(':token', $token); $getstuff->bindParam(':token', $token);
$getstuff->execute(); $getstuff->execute();
$china = $getstuff->fetch(PDO::FETCH_BOTH); $china = $getstuff->fetch(PDO::FETCH_BOTH);
$placeid = $china['placeid']; $placeid = $china['placeid'];
$haha = $con->prepare('SELECT COUNT(*) FROM tokens WHERE token=:token AND passedplacelauncher=:passed'); $okbruh = '1'; // random variable i do because pdo does not allow just "0" or '0'
$haha = $con->prepare('SELECT COUNT(*) FROM tokens WHERE token=:token AND passedplacelauncher=:passed'); // check if it has passed placelauncher yet
$haha->bindParam(':token', $token); $haha->bindParam(':token', $token);
$haha->bindParam(':passed', $okbruh); $haha->bindParam(':passed', $okbruh);
$haha->execute(); $haha->execute();
@ -31,24 +34,24 @@ if ($momentoftruth == 1) {
if ($moretrolling == 1) { if ($moretrolling == 1) {
header("Location: /"); header("Location: /");
} else if ($moretrolling == 0) { } else if ($moretrolling == 0) {
$checkifjobalreadyexists = $con->prepare('SELECT COUNT(*) FROM jobs WHERE placeid=:placeid AND hasended=:hasended'); $checkifjobalreadyexists = $con->prepare('SELECT COUNT(*) FROM jobs WHERE placeid=:placeid AND hasended=:hasended'); // check if theres already a job running and HAS NOT ended
$checkifjobalreadyexists->bindParam(':placeid', $placeid); $checkifjobalreadyexists->bindParam(':placeid', $placeid);
$helppdo = '0'; $helppdo = '0'; // random variable i do because pdo does not allow just "0" or '0' (2x)
$checkifjobalreadyexists->bindParam(':hasended', $helppdo); $checkifjobalreadyexists->bindParam(':hasended', $helppdo);
$checkifjobalreadyexists->execute(); $checkifjobalreadyexists->execute();
$okcheck = $checkifjobalreadyexists->fetchColumn(); $okcheck = $checkifjobalreadyexists->fetchColumn();
if ($okcheck == 1) { if ($okcheck == 1) {
$passedplacelauncher = '1'; $passedplacelauncher = '1';
$hahatroll = $con->prepare('UPDATE tokens SET passedplacelauncher = :passedplacelauncher WHERE token=:token'); $hahatroll = $con->prepare('UPDATE tokens SET passedplacelauncher = :passedplacelauncher WHERE token=:token'); // make the current token not able to get another placelauncher response
$hahatroll->bindParam(':passedplacelauncher', $passedplacelauncher); $hahatroll->bindParam(':passedplacelauncher', $passedplacelauncher);
$hahatroll->bindParam(':token', $token); $hahatroll->bindParam(':token', $token);
$hahatroll->execute(); $hahatroll->execute();
$getjobforalready = $con->prepare('SELECT jobid FROM jobs WHERE placeid=:placeid AND hasended=:hasended'); $getjobforalready = $con->prepare('SELECT jobid FROM jobs WHERE placeid=:placeid AND hasended=:hasended'); // get the jobid if theres already a job running
$getjobforalready->bindParam(':placeid', $placeid); $getjobforalready->bindParam(':placeid', $placeid);
$getjobforalready->bindParam(':hasended', $helppdo); $getjobforalready->bindParam(':hasended', $helppdo);
$getjobforalready->execute(); $getjobforalready->execute();
$china2 = $getjobforalready->fetch(PDO::FETCH_BOTH); $china2 = $getjobforalready->fetch(PDO::FETCH_BOTH);
$jobid = $china2['jobid']; $jobid = $china2['jobid']; // get the jobid from pdo
$response = [ $response = [
"jobId" => $jobid, "jobId" => $jobid,
"status" => $status, "status" => $status,
@ -57,14 +60,14 @@ if ($momentoftruth == 1) {
"authenticationTicket" => $token, "authenticationTicket" => $token,
"message" => $allstatus[$status] "message" => $allstatus[$status]
]; ];
echo json_encode($response); die(json_encode($response)); // DON'T FORGET TO DIE OR ELSE IT MIGHT FOLLOW THE SCRIPT UNTIL IT CAN'T FOLLOW IT ANYMORE
} else if ($okcheck == 0) { } elseif ($okcheck == 0) {
$passedplacelauncher = '1'; // IF THIS IS 0 THEN IT MEANS PLACELAUNCHER HASN'T PASSED MAKE SURE THIS IS ONLY IN UR TESTING $passedplacelauncher = '1'; // IF THIS IS 0 THEN IT MEANS PLACELAUNCHER HASN'T PASSED MAKE SURE THIS ITS 1 ONLY IN UR TESTING
$hahatroll = $con->prepare('UPDATE tokens SET passedplacelauncher = :passedplacelauncher WHERE token=:token'); $hahatroll = $con->prepare('UPDATE tokens SET passedplacelauncher = :passedplacelauncher WHERE token=:token'); // i don't remember but its the same thing as earlier maybe
$hahatroll->bindParam(':passedplacelauncher', $passedplacelauncher); $hahatroll->bindParam(':passedplacelauncher', $passedplacelauncher);
$hahatroll->bindParam(':token', $token); $hahatroll->bindParam(':token', $token);
$hahatroll->execute(); $hahatroll->execute();
function generateRandomJobId() { function generateRandomJobId() { // jobid generator
$chars = '0123456789abcdefghijklmnopqrstuvwxyz'; $chars = '0123456789abcdefghijklmnopqrstuvwxyz';
$length = 8; $length = 8;
$p1 = substr(str_shuffle(str_repeat($x=$chars, ceil($length/strlen($x)) )),1,$length); $p1 = substr(str_shuffle(str_repeat($x=$chars, ceil($length/strlen($x)) )),1,$length);
@ -78,8 +81,7 @@ if ($momentoftruth == 1) {
$p5 = substr(str_shuffle(str_repeat($x=$chars, ceil($length/strlen($x)) )),1,$length); $p5 = substr(str_shuffle(str_repeat($x=$chars, ceil($length/strlen($x)) )),1,$length);
return $p1."-".$p2."-".$p3."-".$p4."-".$p5; return $p1."-".$p2."-".$p3."-".$p4."-".$p5;
} }
$jobid = generateRandomJobId(); function generateRandomString($length = 25) { // random string generator used for generating access tokens
function generateRandomString($length = 25) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters); $charactersLength = strlen($characters);
$randomString = ''; $randomString = '';
@ -88,133 +90,235 @@ function generateRandomString($length = 25) {
} }
return $randomString; return $randomString;
} }
$port = rand(5000,5999); $port = rand(5000,5999); // generate random port
$checkport = $con->prepare('SELECT COUNT(*) FROM tokens WHERE token=:token AND passedplacelauncher=:passed'); $checkport = $con->prepare('SELECT COUNT(*) FROM jobs WHERE placeid=:placeid AND port=:port'); // check if the port has already been used
$checkport->bindParam(':token', $token); $checkport->bindParam(':placeid', $placeid);
$checkport->bindParam(':passed', $okbruh); $checkport->bindParam(':port', $port);
$checkport->execute(); $checkport->execute();
$okbrahh = $checkport->fetchColumn(); $okbrahh = $checkport->fetchColumn();
if ($okbrahh == 1) { if ($okbrahh == 1) {
$port = rand(5000,5999); // great heavens if this ever happens report to me $port = rand(5000,5999); // great heavens if this ever happens report to me
die("How did we get here?");
} else if ($okbrahh == 0) { } else if ($okbrahh == 0) {
$accesstoken = generateRandomString(500); $accesstoken = generateRandomString(500); // generate a accesstoken used by rcc to get the placefile
$okaccesstoken = $con->prepare('INSERT INTO accesstokens (ip, accesstoken, placeid, jobid) VALUES (:ip, :accesstoken, :placeid, :jobid)'); $jobid = generateRandomJobId(); // get a random jobid
$okaccesstoken->bindParam(':ip', $AvailableGameservers[1]); $placeid = $placeid; // idk why i did this but i did it
$ip = $AvailableGameservers["1"]; // get the ip from the config
$okaccesstoken = $con->prepare('INSERT INTO accesstokens (ip, accesstoken, placeid, jobid) VALUES (:ip, :accesstoken, :placeid, :jobid)'); // insert the accesstoken
$okaccesstoken->bindParam(':ip', $ip);
$okaccesstoken->bindParam(':accesstoken', $accesstoken); $okaccesstoken->bindParam(':accesstoken', $accesstoken);
$okaccesstoken->bindParam(':placeid', $placeid); $okaccesstoken->bindParam(':placeid', $placeid);
$okaccesstoken->bindParam(':jobid', $jobid); $okaccesstoken->bindParam(':jobid', $jobid);
$okaccesstoken->execute(); $okaccesstoken->execute();
$RCCServiceSoap = new Roblox\Grid\Rcc\RCCServiceSoap("192.168.1.129", 64989); $RCCServiceSoap = new Roblox\Grid\Rcc\RCCServiceSoap($ip, 64989); // start the job
$https = "https://"; // script starts here
$script = 'print("Starting a new gameserver with JobID: " .. "' . $jobid . '" .. " and PlaceID: " .. "' . $placeid . '") $script = 'print("Starting gameserver at PlaceID: '. $placeid .' on port: '. $port .' with JobID: '. $jobid .'")
-- Start Game Script Arguments
local placeId = ' . (int)$placeid . ' local placeId = '. $placeid .'
local url = "'. $site['url'] . '" local port = '. $port .'
local accesstoken = "' . $accesstoken . '" local gameId = "'. $jobid .'"
local sleeptime = 0
------------------- UTILITY FUNCTIONS -------------------------- local access = "'. $accesstoken .'"
function waitForChild(parent, childName) local deprecated = false
while true do local timeout = 60
local child = parent:findFirstChild(childName) local machineAddress = "'. $ip .'"
if child then local gsmInterval = 2
return child local baseUrl = "sierraf.tk"
local maxPlayers = 60
local maxGameInstances = 1
local injectScriptAssetID = 0
local apiKey = "'. $accesstoken .'"
local libraryRegistrationScriptAssetID = 0
local deprecated_pingTimesReportInterval = 2
local gameCode = 0
local universeId = "'. $jobid .'"
local preferredPlayerCapacity = 60
local matchmakingContextId = 0
local placeVisitAccessKey = "'. $accesstoken .'"
local assetGameSubdomain = "assetgame"
local protocol = "https://"
-----------------------------------"CUSTOM" SHARED CODE----------------------------------
pcall(function() settings().Network.UseInstancePacketCache = true end)
pcall(function() settings().Network.UsePhysicsPacketCache = true end)
pcall(function() settings()["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.AccumulatedError end)
settings().Network.PhysicsSend = Enum.PhysicsSendMethod.TopNErrors
settings().Network.ExperimentalPhysicsEnabled = true
settings().Network.WaitingForCharacterLogRate = 100
pcall(function() settings().Diagnostics:LegacyScriptMode() end)
-----------------------------------START GAME SHARED SCRIPT------------------------------
local assetId = placeId -- might be able to remove this now
local url = nil
local assetGameUrl = nil
local accesstoken = placeVisitAccessKey
if baseUrl~=nil and protocol ~= nil then
url = protocol .. "www." .. baseUrl --baseUrl is actually the domain, no leading .
assetGameUrl = protocol .. assetGameSubdomain .. "." .. baseUrl
end end
parent.ChildAdded:wait()
end local scriptContext = game:GetService("ScriptContext")
end pcall(function() scriptContext:AddStarterScript(libraryRegistrationScriptAssetID) end)
-----------------------------------END UTILITY FUNCTIONS ------------------------- scriptContext.ScriptsDisabled = true
-----------------------------------"CUSTOM" SHARED CODE----------------------------------
pcall(function() settings().Network.UseInstancePacketCache = true end) game:SetPlaceID(assetId, false)
pcall(function() settings().Network.UsePhysicsPacketCache = true end) pcall(function () if universeId ~= nil then game:SetUniverseId(universeId) end end)
--pcall(function() settings()["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.FIFO end) game:GetService("ChangeHistoryService"):SetEnabled(false)
pcall(function() settings()["Task Scheduler"].PriorityMethod = Enum.PriorityMethod.AccumulatedError end)
--settings().Network.PhysicsSend = 1 -- 1==RoundRobin -- establish this peer as the Server
--settings().Network.PhysicsSend = Enum.PhysicsSendMethod.ErrorComputation2 local ns = game:GetService("NetworkServer")
settings().Network.PhysicsSend = Enum.PhysicsSendMethod.TopNErrors -- Detect cloud edit mode by checking for the dedicated cloud edit matchmaking context
settings().Network.ExperimentalPhysicsEnabled = true local isCloudEdit = matchmakingContextId == 3
settings().Network.WaitingForCharacterLogRate = 100 if isCloudEdit then
pcall(function() settings().Diagnostics:LegacyScriptMode() end) print("Configuring as cloud edit server!")
-----------------------------------START GAME SHARED SCRIPT------------------------------ game:SetServerSaveUrl(url .. "/ide/publish/UploadFromCloudEdit")
local assetId = placeId -- might be able to remove this now ns:ConfigureAsCloudEditServer()
local scriptContext = game:GetService("ScriptContext") end
pcall(function() scriptContext:AddStarterScript(37801172) end)
scriptContext.ScriptsDisabled = true local badgeUrlFlagExists, badgeUrlFlagValue = pcall(function () return settings():GetFFlag("NewBadgeServiceUrlEnabled") end)
game:SetPlaceID(assetId, false) local newBadgeUrlEnabled = badgeUrlFlagExists and badgeUrlFlagValue
game:GetService("ChangeHistoryService"):SetEnabled(false) if url~=nil then
-- establish this peer as the Server local apiProxyUrl = "https://api." .. baseUrl -- baseUrl is really the domain
local ns = game:GetService("NetworkServer")
if url~=nil then pcall(function() game:GetService("Players"):SetAbuseReportUrl(url .. "/AbuseReport/InGameChatHandler.ashx") end)
pcall(function() game:GetService("Players"):SetAbuseReportUrl(url .. "/AbuseReport/InGameChatHandler.ashx") end) pcall(function() game:GetService("ScriptInformationProvider"):SetAssetUrl(assetGameUrl .. "/Asset/") end)
pcall(function() game:GetService("ScriptInformationProvider"):SetAssetUrl(url .. "/Asset/") end) pcall(function() game:GetService("ContentProvider"):SetBaseUrl(url .. "/") end)
pcall(function() game:GetService("ContentProvider"):SetBaseUrl(url .. "/") end) -- pcall(function() game:GetService("Players"):SetChatFilterUrl(assetGameUrl .. "/Game/ChatFilter.ashx") end)
--pcall(function() game:GetService("Players"):SetChatFilterUrl(url .. "/Game/ChatFilter.ashx") end)
game:GetService("BadgeService"):SetPlaceId(placeId) if gameCode then
game:GetService("BadgeService"):SetIsBadgeLegalUrl("") game:SetVIPServerId(tostring(gameCode))
game:GetService("InsertService"):SetBaseSetsUrl(url .. "/Game/Tools/InsertAsset.ashx?nsets=10&type=base") end
game:GetService("InsertService"):SetUserSetsUrl(url .. "/Game/Tools/InsertAsset.ashx?nsets=20&type=user&userid=%d")
game:GetService("InsertService"):SetCollectionUrl(url .. "/Game/Tools/InsertAsset.ashx?sid=%d") game:GetService("BadgeService"):SetPlaceId(placeId)
game:GetService("InsertService"):SetAssetUrl(url .. "/Asset/?id=%d")
game:GetService("InsertService"):SetAssetVersionUrl(url .. "/Asset/?assetversionid=%d") if newBadgeUrlEnabled then
game:GetService("BadgeService"):SetAwardBadgeUrl(apiProxyUrl .. "/assets/award-badge?userId=%d&badgeId=%d&placeId=%d")
pcall(function() loadfile(url .. "/Game/LoadPlaceInfo.ashx?PlaceId=" .. placeId)() end) end
-- pcall(function() if access ~= nil then
-- if access then if not newBadgeUrlEnabled then
-- loadfile(url .. "/Game/PlaceSpecificScript.ashx?PlaceId=" .. placeId .. "&" .. access)() game:GetService("BadgeService"):SetAwardBadgeUrl(assetGameUrl .. "/Game/Badge/AwardBadge.ashx?UserID=%d&BadgeID=%d&PlaceID=%d")
-- end end
-- end)
end game:GetService("BadgeService"):SetHasBadgeUrl(assetGameUrl .. "/Game/Badge/HasBadge.ashx?UserID=%d&BadgeID=%d")
pcall(function() game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) end) game:GetService("BadgeService"):SetIsBadgeDisabledUrl(assetGameUrl .. "/Game/Badge/IsBadgeDisabled.ashx?BadgeID=%d&PlaceID=%d")
settings().Diagnostics.LuaRamLimit = 0
--settings().Network:SetThroughputSensitivity(0.08, 0.01) game:GetService("FriendService"):SetMakeFriendUrl(assetGameUrl .. "/Game/CreateFriend?firstUserId=%d&secondUserId=%d")
--settings().Network.SendRate = 35 game:GetService("FriendService"):SetBreakFriendUrl(assetGameUrl .. "/Game/BreakFriend?firstUserId=%d&secondUserId=%d")
--settings().Network.PhysicsSend = 0 -- 1==RoundRobin game:GetService("FriendService"):SetGetFriendsUrl(assetGameUrl .. "/Game/AreFriends?userId=%d")
game:GetService("Players").PlayerAdded:connect(function(player) end
if game.Players.NumPlayers ~= 0 then game:GetService("BadgeService"):SetIsBadgeLegalUrl("")
print(loadfile(url .. "/api/UpdatePlayerCount?accesstoken=" .. accesstoken .. "&playercount=" .. game.Players.NumPlayers)) game:GetService("InsertService"):SetBaseSetsUrl(assetGameUrl .. "/Game/Tools/InsertAsset.ashx?nsets=10&type=base")
print("Successfully Updated Player count for JobID: " . "' . $jobid . '") game:GetService("InsertService"):SetUserSetsUrl(assetGameUrl .. "/Game/Tools/InsertAsset.ashx?nsets=20&type=user&userid=%d")
else game:GetService("InsertService"):SetCollectionUrl(assetGameUrl .. "/Game/Tools/InsertAsset.ashx?sid=%d")
print(loadfile(url .. "/api/CloseJob?accesstoken=" .. accesstoken)) game:GetService("InsertService"):SetAssetUrl(assetGameUrl .. "/Asset/?id=%d")
print("Job ID: " .. "' . $jobid . '" .. " is closing due to no active players.") game:GetService("InsertService"):SetAssetVersionUrl(assetGameUrl .. "/Asset/?assetversionid=%d")
end
print("Player " .. player.userId .. " added") if gameCode then
end) pcall(function() loadfile(assetGameUrl .. "/Game/LoadPlaceInfo.ashx?PlaceId=" .. placeId .. "&gameCode=" .. tostring(gameCode))() end)
game:GetService("Players").PlayerRemoving:connect(function(player) else
if game.Players.NumPlayers ~= 0 then pcall(function() loadfile(assetGameUrl .. "/Game/LoadPlaceInfo.ashx?PlaceId=" .. placeId)() end)
print(loadfile(url .. "/api/UpdatePlayerCount?accesstoken=" .. accesstoken .. "&playercount=" .. game.Players.NumPlayers)) end
print("Successfully Updated Player count for JobID: " . "' . $jobid . '")
else pcall(function()
print(loadfile(url .. "/api/CloseJob?accesstoken=" .. accesstoken)) if access then
print("Job ID: " .. "' . $jobid . '" .. " is closing due to no active players.") loadfile(assetGameUrl .. "/Game/PlaceSpecificScript.ashx?PlaceId=" .. placeId)()
end end
print("Player " .. player.userId .. " leaving") end)
end) end
if placeId~=nil and url~=nil then
-- yield so that file load happens in the heartbeat thread pcall(function() game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) end)
wait() settings().Diagnostics.LuaRamLimit = 0
-- load the game game:GetService("Players").PlayerAdded:connect(function(player)
game:Load(url .. "/asset/?id=" .. placeId .. "?accesstoken=" .. accesstoken) print("Player " .. player.userId .. " added")
end
-- Now start the connection if assetGameUrl and access and placeId and player and player.userId then
ns:Start(' . $port . ') local didTeleportIn = "False"
scriptContext:SetTimeout(10) if player.TeleportedIn then didTeleportIn = "True" end
scriptContext.ScriptsDisabled = false
------------------------------END START GAME SHARED SCRIPT-------------------------- -- game:HttpGet(assetGameUrl .. "/Game/ClientPresence.ashx?action=connect&PlaceID=" .. placeId .. "&UserID=" .. player.userId)
-- StartGame -- if not isCloudEdit then
game:GetService("RunService"):Run() game:HttpPost(assetGameUrl .. "/Game/PlaceVisit.ashx?UserID=" .. player.userId .. "&AssociatedPlaceID=" .. placeId .. "&placeVisitAccessKey=" .. placeVisitAccessKey .. "&IsTeleport=" .. didTeleportIn, "")
'; end
$job = new Roblox\Grid\Rcc\Job($jobid, 99999999999); // pls only set to this amount WHEN ur hosting a gameserver when ur rendering do like 10 minutes end
$funny = new Roblox\Grid\Rcc\ScriptExecution("Script".rand(1,getrandmax()), $script); end)
$result = $RCCServiceSoap->OpenJob($job, $funny);
jobOpened($jobid, 99999999999); game:GetService("Players").PlayerRemoving:connect(function(player)
$sendthatjob = $con->prepare('INSERT INTO jobs (jobid, placeid, port, ip) VALUES (:jobid, :placeid, :port, :ip)'); print("Player " .. player.userId .. " leaving")
local isTeleportingOut = "False"
if player.Teleported then isTeleportingOut = "True" end
if assetGameUrl and access and placeId and player and player.userId then
game:HttpGet(assetGameUrl .. "/Game/ClientPresence.ashx?action=disconnect&PlaceID=" .. placeId .. "&UserID=" .. player.userId .. "&IsTeleport=" .. isTeleportingOut .. "&placeVisitAccessKey=" .. accesstoken)
end
end)
local onlyCallGameLoadWhenInRccWithAccessKey = newBadgeUrlEnabled
if placeId ~= nil and assetGameUrl ~= nil and ((not onlyCallGameLoadWhenInRccWithAccessKey) or access ~= nil) then
-- yield so that file load happens in the heartbeat thread
wait()
-- load the game
game:Load(assetGameUrl .. "/asset/?id=" .. placeId .. "&accesstoken=" .. accesstoken)
end
-- Configure CloudEdit saving after place has been loaded
if isCloudEdit then
local doPeriodicSaves = true
local delayBetweenSavesSeconds = 5 * 60 -- 5 minutes
local function periodicSave()
if doPeriodicSaves then
game:ServerSave()
delay(delayBetweenSavesSeconds, periodicSave)
end
end
-- Spawn thread to save in the future
delay(delayBetweenSavesSeconds, periodicSave)
-- Hook into OnClose to save on shutdown
game.OnClose = function()
doPeriodicSaves = false
game:ServerSave()
end
end
-- Now start the connection
ns:Start(port, sleeptime)
if timeout then
scriptContext:SetTimeout(timeout)
end
scriptContext.ScriptsDisabled = false
-- StartGame --
if not isCloudEdit then
if injectScriptAssetID and (injectScriptAssetID < 0) then
pcall(function() Game:LoadGame(injectScriptAssetID * -1) end)
else
pcall(function() Game:GetService("ScriptContext"):AddStarterScript(injectScriptAssetID) end)
end
Game:GetService("RunService"):Run()
end
';
$job = new Roblox\Grid\Rcc\Job($jobid, 99999999999); // pls only set to this amount WHEN ur hosting a gameserver when ur rendering do like 10 minutes
$funny = new Roblox\Grid\Rcc\ScriptExecution("Script".rand(1,getrandmax()), $script); // uhhhh idk but this is related to multiple scripts running or smthing like that
$result = $RCCServiceSoap->OpenJob($job, $funny); // open the job
jobOpened($jobid, 99999999999); // sends message to discord webhook that a job started
$sendthatjob = $con->prepare('INSERT INTO jobs (jobid, placeid, port, ip) VALUES (:jobid, :placeid, :port, :ip)'); // get the job in the database!
$sendthatjob->bindParam(':jobid', $jobid); $sendthatjob->bindParam(':jobid', $jobid);
$sendthatjob->bindParam(':placeid', $placeid); $sendthatjob->bindParam(':placeid', $placeid);
$sendthatjob->bindParam(':port', $port); $sendthatjob->bindParam(':port', $port);
$sendthatjob->bindParam(':ip', $AvailableGameservers[1]); $sendthatjob->bindParam(':ip', $AvailableGameservers[1]);
$sendthatjob->execute(); $sendthatjob->execute();
// give the response to the client
$response = [ $response = [
"jobId" => $jobid, "jobId" => $jobid,
"status" => $status, "status" => $status,
@ -223,11 +327,12 @@ function generateRandomString($length = 25) {
"authenticationTicket" => $token, "authenticationTicket" => $token,
"message" => $allstatus[$status] "message" => $allstatus[$status]
]; ];
echo json_encode($response); die(json_encode($response)); // make sure to die
} }
} }
} else { } else {
header("Location: /"); header("Location: /");
} }
} }
}
?> ?>