Hello. I don't usually come to forums for help, but I think that at this point I'm pretty stuck. I'm not the best at PHP/JavaScript, but I've been working on this loading screen quite constantly and can't figure out the preset functions that are called when a player joins a game. Everything else works fine, it's just not changing text at all.
Here's a snippet from my JavaScript file.
[CODE]
function GameDetails( servername, serverurl, mapname, maxplayers, steamid, gamemode ) {
document.getElementById("gm").innerHTML = gamemode;
}
function SetStatusChanged( status ) {
document.getElementById("status").innerHTML = status;
}
function DownloadingFile( file ) {
document.getElementById("downloading").innerHTML = file;
}
[/CODE]
Here's a snippet of my PHP file.
[CODE]
<?php
$id = $_GET["steamid"];
$map = $_GET['mapname'];
$name = "Player";
$avatar = "images/no-user.jpg";
if (isset($_GET['steamid'])) {
$plydata = 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=STEAMKEY&steamids='.$id."&format=json";
$f = file_get_contents($data);
$array = json_decode($f, true);
if (isset($array['response']['players'][0]['personaname']))
$name = $array['response']['players'][0]['personaname'];
if (isset($array['response']['players'][0]['avatarmedium']))
$avatar = $array['response']['players'][0]['avatarmedium'];
}
?>
** Some HTML **
<div id="details">Current Map: <span id="map"><?php echo $map ?></span><br>
Current Gamemode: <span id="gm">gamemode</span>
</div>
<div id="playerinfo">
<img id="avatar" src="<?php echo $avatar; ?>" />
Hey there, <span id="name"><?php echo $name; ?></span>
</div>
** More HTML **
<div id="status">Retrieving Server Info...</div>
<div id="files">You're downloading: <span id="downloading">#</span></div>
[/CODE]
So to really sum it all up, I can't seem to get "Retrieving Server Info...", the player's avatar, the map or the gamemode, and the "You're Downloading: #" to change. I would appreciate any help. Thank you all in advance. If you need it, the loading screen's url is [url]http://vice-network.com/simpleLoad/[/url]
Don't use javascript to insert php code, simply put your php code inside your html document.
Also, use echo instead of print. Echo is faster with that kind of things.
[QUOTE=Rocket;48234033]Are you looking at a different file than we are?[/QUOTE]
He edited his post ... I'm sorry it won't happen again.
Yeah, I did edit the post, my bad. I updated it so that way when people look at it it's not too different from what I have.
I set "http://vice-network.com/simpleLoad/" as the URL in sv_loadingurl.
[QUOTE=NerfModder;48234258]I set "http://vice-network.com/simpleLoad/" as the URL in sv_loadingurl.[/QUOTE]
Should be [url]http://vice-network.com/simpleLoad/?steamid=%s&mapname=%m[/url] then
Also:
[quote]$plydata = 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=STEAMKEY&steamids='.$id."&format=json";
$f = file_get_contents($data);[/quote]
Replace $data to $plydata
Alright, but what about the reason why "Retrieving Server Info..." and "You're Downloading: #" won't change, do you know?
I replaced my API key with "STEAMKEY" since we're not supposed to tell anybody them. Thanks, I'll try putting them in the HTML page.
[editline]18th July 2015[/editline]
Nevermind, I guess that it worked for some things. Thanks!
[editline]18th July 2015[/editline]
All is well! I figured it out, thank you all for the help! Just one tid-bit is I'm not sure if the "Downloading File: #" changes, but that's alright.
Sorry, you need to Log In to post a reply to this thread.