loadfile("http://api.xdiscuss.net/Asset/?id=500&tick=" .. tick())() -- Main gui setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $dbcon->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); }catch (PDOExpection $e){ exit; } // User row $stmtU = $dbcon->prepare("SELECT * FROM users WHERE id=:id;"); $stmtU->bindParam(':id', $userID, PDO::PARAM_INT); $stmtU->execute(); $rUser = $stmtU->fetch(PDO::FETCH_ASSOC); // Game row $stmtG = $dbcon->prepare("SELECT * FROM games WHERE id=:id;"); $stmtG->bindParam(':id', $gameID, PDO::PARAM_INT); $stmtG->execute(); $rGame = $stmtG->fetch(PDO::FETCH_ASSOC); // Throw an error on the client if the game does not exist if ($stmtU->rowCount() == 0 or $stmtG->rowCount() == 0) die('game:GetService("NetworkClient") game:GetService("Visit"):SetUploadUrl("") setMessage("Server not found!");'); // Throw an error on the client if the user is not authorized to join the game if ($rGame['public'] == 0) { $gameKey = $rGame['key']; $stmtU = $dbcon->prepare("SELECT * FROM gameKeys WHERE userid=:id AND `key` = :key;"); $stmtU->bindParam(':id', $userID, PDO::PARAM_INT); $stmtU->bindParam(':key', $gameKey, PDO::PARAM_STR); $stmtU->execute(); if ($stmtU->rowCount() == 0 and $rGame['creator_uid'] != $userID and $rUser['rank'] == 0) die('game:GetService("NetworkClient") game:GetService("Visit"):SetUploadUrl("") setMessage("You are not authorized to join this server.");'); } // If a special ban is enabled, it will "fail to connect". if ($rUser['publicBan'] == 1) die('game:GetService("NetworkClient") game:GetService("Visit"):SetUploadUrl("") setMessage("Unable to connect to Graphictoria");'); // Throw an error if the authentication keys do not match if ($pkey != $rUser['gameKey']) die('game:GetService("NetworkClient") game:GetService("Visit"):SetUploadUrl("") setMessage("Authentication has failed.");'); $dbcon = null; // We're done with the database. ?> game:GetService("RunService"):Run() settings().Diagnostics:LegacyScriptMode() game:SetRemoteBuildMode(true) setMessage("Connecting to the server") local visit = game:GetService("Visit") visit:SetUploadUrl("") local networkClient = game:GetService("NetworkClient") local player = networkClient:PlayerConnect(, "", , 20, 0) player.Name = "" player.CharacterAppearance = "http://api.xdiscuss.net/user/getCharacter.php?uid=&key=D869593BF742A42F79915993EF1DB&tick=" networkClient.ConnectionFailed:connect(function() setMessage("Connection to the server has failed") end) networkClient.ConnectionRejected:connect(function() setMessage("Connection has been rejected") end) networkClient.ConnectionAccepted:connect(function(peer, replicator) local isLoading = true player.Changed:connect(function(change) if (change == "Character") then isLoading = false setMessage("") end end) while (isLoading) do wait(0.5) game.Workspace:ZoomToExtents() if (isLoading) then setMessage("Loading game...") end end replicator.Disconnection:connect(function() setMessage("Connection to the server has been lost") end) end) loadfile("http://api.xdiscuss.net/Asset/?id=501&tick=" .. tick())() -- Player list