Last active
August 29, 2015 14:25
-
-
Save Scrxtchy/594da585e81cf4965655 to your computer and use it in GitHub Desktop.
GarryMod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// A Steam API Key is required so as to be able to contact steam and get a users profile image and name | |
// You can get a Steam API Key by visiting http://steamcommunity.com/dev/apikey | |
// Don't worry about the web address, it won't have any effect so just type in any web site | |
// Once you have your steam API Key simply paste the key below. (Make sure the quotation marks are still there or else it won't work) | |
$SteamAPIKey = ""; | |
// Don't edit any of the PHP stuff here or else you may break the script | |
// If you website isn't displaying correctly then please make sure you have configured your loading url correctly | |
if (!isset($_GET["steamid"])) { | |
die("Woops, you don't seem to be using the correct loading URL format, please make sure it has the correct extension it should look like this: www.yourdomain.com/loading/index.php?steamid=%s"); | |
} | |
$steamid64 = $_GET["steamid"]; | |
$url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=" . $SteamAPIKey . "&steamids=" . $steamid64; | |
$json = file_get_contents($url); | |
$table2 = json_decode($json, true); | |
$table = $table2["response"]["players"][0]; | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<link rel="stylesheet" href="animations.css"> | |
<link rel="stylesheet" href="styles.css"/> | |
<link rel="stylesheet" href="font-awesome/css/font-awesome.min.css"> | |
<link rel="shortcut icon" type="image/x-icon" href="icon_cchara.png" /> | |
<style> | |
body { | |
width: 100%; | |
height: 100%; | |
background-color:aliceblue; | |
} | |
#title { | |
font-family: "Segoe UI"; | |
font-size: 8em; | |
top: 40%; | |
#loading { | |
width: 70%; | |
height: 54px; | |
-webkit-border-radius: 8px; | |
background: rgba(48, 48, 48, 0.46); | |
top: 60%; | |
left: 50px; | |
position: absolute; | |
} | |
#loadp { | |
height: 100%; | |
border-top-left-radius:8px; | |
border-bottom-left-radius:8px; | |
background: rgba(173, 173, 173, 0.74); | |
} | |
#percentage p { | |
float: right; | |
font-family: "Lucida Console", Monaco, monospace; | |
color: white; | |
font-weight: 400; | |
font-size: 16pt; | |
margin-top: 50px; | |
border-right-color: white; | |
border-right-width: 2px; | |
border-right-style: solid; | |
top: -75px; | |
position: relative; | |
padding-bottom: 58px; | |
} | |
#serverinfo { | |
top: 72%; | |
color:#FFFFFF; | |
font-family:"Lucida Console", Monaco, monospace; | |
font-size:15px; | |
left: 50px; | |
position:absolute; | |
} | |
#description { | |
left:5%; | |
color:#FFFFFF; | |
position:absolute; | |
font-family:"Lucida Console", Monaco, monospace; | |
font-size:20px; | |
} | |
#loadingtext { | |
color:#FFFFFF; | |
left:2.5%; | |
bottom:10%; | |
position:absolute; | |
font-family:"Lucida Console", Monaco, monospace; | |
font-size:20px; | |
background-color:rgba(102,102,102,0.3); | |
padding:10px; | |
-webkit-border-radius:3px; | |
text-shadow:3px 3px 2px rgba(0,0,0,0.5) | |
} | |
} | |
</style> | |
<title></title> | |
</head> | |
<body> | |
<div id="title" align="center"><!--Overriden--></div> | |
<div id="loading"> | |
<!-- Default it to 0% --> | |
<div id="loadp" style="width: 0%;"> | |
<div id="percentage"> | |
<p>0%</p> | |
</div> | |
</div> | |
</div> | |
<div id="serverinfo"> | |
</div> | |
<script type="application/javascript"> | |
//Show the current map below the loading bar | |
var ShowMap = true; //true - false | |
//Don't touch this stuff unless you know what you're doing | |
var iFilesNeeded = 0; | |
var iFilesTotal = 0; | |
var bDownloadingFile = false; | |
var Diff = 0; | |
var Perc = 0; | |
var serverinfo; | |
var gamemodefullname; | |
var PercNaN = true; | |
var force99 = false; | |
var ServerNameAsTitle = true; | |
var UseFullNames = true; | |
var ShowGameMode = true; | |
function SetFilesNeeded( needed, total ) | |
{ | |
iFilesNeeded = needed; | |
RefreshFileBox(); | |
} | |
function SetFilesTotal( total ) | |
{ | |
iFilesTotal = total; | |
RefreshFileBox(); | |
} | |
function DownloadingFile( filename ) | |
{ | |
if ( bDownloadingFile ) | |
{ | |
iFilesNeeded = iFilesNeeded - 1; | |
RefreshFileBox(); | |
} | |
document.getElementById( "loadingtext" ).innerHTML = filename ; | |
bCanChangeStatus = false; | |
setTimeout( "bCanChangeStatus = true;", 1000 ); | |
bDownloadingFile = true; | |
} | |
function SetStatusChanged( status ) | |
{ | |
if (status === "Sending client info...") { | |
//Check for a loading end, just to fix a loading error | |
force99 = true; | |
RefreshFileBox(); | |
} | |
if ( bDownloadingFile ) | |
{ | |
iFilesNeeded = iFilesNeeded - 1; | |
bDownloadingFile = false; | |
RefreshFileBox(); | |
} | |
document.getElementById( "loadingtext" ).innerHTML = status ; | |
bCanChangeStatus = false; | |
setTimeout( "bCanChangeStatus = true;", 1000 ); | |
} | |
function RefreshFileBox() | |
{ | |
Diff = Math.round(iFilesTotal - iFilesNeeded); | |
if (force99) { | |
Perc = 99; | |
} else { | |
Perc = Math.round(Diff / iFilesTotal * 100); | |
} | |
document.getElementById( "loading" ).innerHTML = "<div id='loadp' style='width:" + Perc + "%;'><div id='percentage'><p>" + Perc + "% </p></div></div>"; | |
} | |
function GameDetails( servername, serverurl, mapname, maxplayers, steamid, gamemode ) { | |
if (ServerNameAsTitle) { | |
document.getElementById( "title" ).innerHTML = servername; | |
} | |
if (UseFullNames != true) { | |
var gamemodefullname = gamemode; | |
} else { | |
switch (gamemode) | |
//Here we define a list of Full Gamemode names to overwrite the simpler versions used by Garrysmod | |
//These are only used if 'UseFullNames' is set to true | |
//To input your own, make a new 'case' before the 'default' | |
//The case name is the gamemode folder name located at garrysmod/gamemodes | |
//On the second line, start off with the 'gamemodefullname = ' followed by what text you want to show on the page | |
//For example 'gamemodefullname = "My Epic Gamemode's Epic Name"; | |
{ | |
case "sandbox": | |
gamemodefullname = "Sandbox"; | |
break; | |
case "terrortown": | |
gamemodefullname = "Trouble In Terrorist Town"; | |
break; | |
case "darkrp": | |
gamemodefullname = "DarkRP"; | |
break; | |
case "tdm": | |
gamemodefullname = "Team Deathmatch"; | |
break; | |
case "sledbuild": | |
gamemodefullname = "Sled Build"; | |
break; | |
default: | |
gamemodefullname = ""; | |
break; | |
} | |
} | |
//Here we define what goes into the map/gamemode info that is placed under the loading bar | |
if (ShowMap && ShowGameMode ) { | |
serverinfo = "Currently playing " + gamemodefullname + " on " + mapname; | |
} else if (ShowMap) { | |
serverinfo = "Loading: " + mapname; | |
} else { | |
serverinfo = ""; | |
} | |
document.getElementById("serverinfo").innerHTML = serverinfo; | |
} | |
//RefreshFileBox(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment