Multiple servers per game.
This commit is contained in:
parent
6ecb5441c9
commit
a4e16ef24b
|
|
@ -122,7 +122,7 @@ if ($requesttype == "RequestGame") //start new server or join existing one
|
||||||
|
|
||||||
if (Game::UserAccess($gameID, $user->id))
|
if (Game::UserAccess($gameID, $user->id))
|
||||||
{
|
{
|
||||||
$ispbs = false;//(bool)$gInfo->isPersonalServer;
|
$ispbs = (bool)$gInfo->isPersonalServer;
|
||||||
|
|
||||||
//check for open servers
|
//check for open servers
|
||||||
$query = "SELECT * FROM open_servers WHERE gameID = :i AND (status = 0 OR status = 1) ORDER BY status DESC LIMIT 1";
|
$query = "SELECT * FROM open_servers WHERE gameID = :i AND (status = 0 OR status = 1) ORDER BY status DESC LIMIT 1";
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,12 @@ else
|
||||||
//doesnt have any return data, so we set message to true
|
//doesnt have any return data, so we set message to true
|
||||||
$jobClose = new RccServiceHelper($GLOBALS['gamesArbiter']);
|
$jobClose = new RccServiceHelper($GLOBALS['gamesArbiter']);
|
||||||
$jobClose->CloseJob($jobid);
|
$jobClose->CloseJob($jobid);
|
||||||
|
|
||||||
|
$q = $pdo->prepare("UPDATE open_servers SET status = 0 WHERE gameID = :pid AND jobid = :jid AND status = 1");
|
||||||
|
$q->bindParam(":pid", $placeid, PDO::PARAM_INT);
|
||||||
|
$q->bindParam(":jid", $jobid, PDO::PARAM_STR);
|
||||||
|
$q->execute();
|
||||||
|
|
||||||
$message = true;
|
$message = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,4 +178,10 @@ game:GetService("RunService"):Run()
|
||||||
game:HttpGet(baseurl .. "/Game/RegisterServer?jobId=" .. game.JobId)
|
game:HttpGet(baseurl .. "/Game/RegisterServer?jobId=" .. game.JobId)
|
||||||
|
|
||||||
-- Remove server OnClose --
|
-- Remove server OnClose --
|
||||||
game.OnClose = function() sendKillJobSignal() end -- register game as closed when datamodel shutdowns
|
game:GetService('Players').PlayerAdded:wait()
|
||||||
|
while wait(1) do
|
||||||
|
if(game:GetService('Players').NumPlayers == 0) then
|
||||||
|
sendKillJobSignal()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--game.OnClose = function() sendKillJobSignal() end -- register game as closed when datamodel shutdowns
|
||||||
Loading…
Reference in New Issue